maxieduncan

Sunday, 25 October 2009

Creating swap files

In addition to a swap partition you can add a swap file

dd if=/dev/zero of=/swap_file bs=1M count=FILE_SIZE_IN_MB
chown root:root /swap_file
chmod 600 /swap_file
mkswap /swap_file
swapon /swap_file

To enable at start up open /etc/fstab and add:

/swap_file       none            swap    sw              0       0
Unfortunately this doesn't seem to be supported on all virtualised servers

No comments:

Post a Comment