abhi's logbook

Adventures in coding and coding for adventures.

Adding Swap Space

The following creates a 4GB swap file. The count in dd is where you specify this. So if you wanted to create 1GB it would be 1024 *

dd if=/dev/zero of=/swapfile1 bs=1024 count=4194304
mkswap /swapfile1
chown root:root /swapfile1
chmod 0600 /swapfile1
swapon /swapfile1

After you added the swap file you need to add it to /etc/fstab

vi /etc/fstab
/swapfile1 swap swap defaults 0 0