Creating a swap file under Linux

Swap partitions are so last century. These days, it's far better to create a resizable swap file that you can manage without the risk of harming your data partitions resizing or otherwise managing a separate swap partition. There is nearly no effect on performance doing this:

sudo dd if=/dev/zero of=/mnt/512Mb.swap bs=1M count=512
sudo mkswap /mnt/512Mb.swap
sudo swapon /mnt/512Mb.swap
sudo emacs /etc/fstab
/mnt/512Mb.swap none swap sw 0 0

To see if the swap is alive
cat /proc/meminfo
More information:

No comments

Post a Comment