Creating Swap Areas

Tim Chase blinux.list at
Tue Oct 5 22:02:34 UTC 2004

> Interesting. Can you say more about why a partition is
> superior to a file for swap?

All calls to manipulate a swap-file have to go through the
file-system stack of system calls...this means that you've got
the overhead of whichever filesystem you're using.  Things such
as access-control checks, disk-space quotas, and the possiblity
of having it scattered across the surface of the disk.  With a
raw partition, you remove one layer (or possibly more, depending
on how convoluted your file system is) which helps speed things
up.  A raw partition also keeps everything contiguous so that
accesses are faster.  Some of the more modern FS's should help
cut back on this a bit...I think ReiserFS (among others) works
hard to keep things quite contiguous, so you may not see the same
gains there, as perhaps with something a little older (like FAT
or ext2).

Oracle (and perhaps other RDBMS's) makes use of this same
aspect--using a raw partition for faster disk access--to obviate
the need the overhead of the file system.

In theory, you could exacerbate the matter by mounting a 
compressed partition, and then, inside of that, creating your 
swap file.  This would then have the overhead of not only two 
file-systems, but the added overhead of decompressing.

Hopefully that makes a bit of sense?  It's 5:00 here at the end 
of a long day, and time for me to head home.  (grins)


More information about the Blinux-list mailing list