swap file

Laurens Blankers laurens.blankers at gmail.com
Mon Sep 20 08:55:46 PDT 2004

> It used to be faster but I recall reading something about swap files being
> as fast as swap partitions with newer kernels. But don't take my word for
> it.

>From what I understand for best performance all blocks of the swap
file need to be consecutive. So one big peace on the hd. Because of
the speed optimilizations in ext2 and other filesystems this is not
always the case. On a partition this is always true.

Also if the swap file is on a journaling filesystem, writing to the
swap file will result in additional overhead from the journal.

As you can see from my original post the filesystem the swap file is
on needs to be mounted read-write before swap can be activated. This
can cause a problem if for some reason the partition can only be
mounted read-only (e.g. after a crash) and you want to run a program
to recover it that requires more memory than is available.


More information about the lfs-support mailing list