Linux Swap
-
For a partition:
-
Format the new partition with mkswap /dev/sdx1
-
Add the new swap partition to /etc/fstab.
-
Run swapon -a to activate the new swap.
-
To add a swap file:
-
Create the file. This command creates a 1 gigabyte file: dd if=/dev/zero of=/swap bs=1M count=1000
-
Format the swap file: mkswap /swap
-
Add the new swap file to /etc/fstab: /swap swap swap defaults 0 0
-
Run swapon -a to activate the new swap.