swap

Michael ODonnell michael.odonnell at comcast.net
Sat Jan 29 19:10:01 EST 2005


> Does the swap area have to be a partition or can it be a file?
> if it can, are there any disadvantage to doing this?  I'm on RH9
> and recently added a faster hard drive that's got plenty of space.


I've configured a number of machines this way
because in some ways it makes your swap and disk
configurations much more flexible; if you change your
mind about how much swap you want or how big or how
many partitions you want, you can change one without
having to worry about the other.  Very handy.

On the other hand, the whole point of a swap area
is to serve as a place to spill page data when your
working set(s) exceed available RAM.  Spilling them
to a device is (intended to be) the most direct way
to get them to secondary storage, thus freeing the
corresponding amount of RAM; but if you spill to a
regular file that data could reside in the buffer
cache for an indefinite time before getting written
out, just as with any other "regular" file.  During
that time, they're still occupying pages that you are
(well, the VM system is) wishing could be used for
other purposes, which would be defeating the purpose.

So, despite the handiness of using regular files as
swap areas, once the "right" amount of swap for a
given system has been determined I think it's best
to use partitions.

Note: I believe that it's still possible that data
written "directly" to a device can still end up in
the buffer cache in some situations, but the gist of
what I said is still applicable.
 



More information about the gnhlug-discuss mailing list