3

I needed some more swap for something I'm doing so I set up a swap file rather than editing partitions.

Are there any disadvantages to using a swap file instead of a swap partition?

My OS is Debian Linux.

Kristian
  • 3,130
Carbon
  • 165

1 Answers1

5

The main disadvantage is that you won't be able to hibernate.

Having said that, I should admit that I have seen that it is possible, but the procedure looks very dodgy to me, because it involves using the absolute disc address of the swap file. If the swap file moves, the kernel will hibernate all over the files that now occupy the space where the swap file was. I won't touch it, hence my rather dogmatic first sentence.

There are two main advantages:-

  1. It is very easy to change the swap file size, compared with resizing a swap partition.
  2. There is a slight performance benefit, because the swap area is in the middle of the normal file area, so head movements will be smaller (unless the swap partition is on a separate physical disc, when a swap partition will perform better).

I have used both on Ubuntu. I would recommend a swap file if you don't need hibernation.

AFH
  • 17,958