swap file

Laurens Blankers laurens.blankers at gmail.com
Sun Sep 19 02:09:16 PDT 2004


I want to use a swap file instead of swap partition, I found some
documentation on how to do that, but mostly out-dated.

Is the following procedure correct?

1. Create a file of 256 MB

# dd if=/dev/zero of=/swap bs=4096 count=65536

2. Make it a swap file

# mkswap /swap

3. Add the following line to /etc/fstab

/swap           swap            swap    pri=1           0       0

4. First mount the filesystem read-write, then activate the swap

# mv /etc/rc.d/rcsysinit.d/S20swap /etc/rc.d/rcsysinit.d/S45swap

Should this work? The file in on a journeling filesystem (ext3), could
this cause problems?

Sincerly,

Laurens



More information about the lfs-support mailing list