Swapfile setup
To setup a 16GB swap file (with 16383 1-M
blocks), do the following. Remember, the dd command can ruin not only
your disk, but also your life when it deletes important and non-backed-up files, so be
very careful with it.
- $ sudo dd if=/dev/zero of=/swap16GB bs=1M count=16384
- $ sudo chmod 600 /swap16GB
- $ sudo mkswap /swap16GB
- Edit /etc/fstab using sudo: $ sudo emacs /etc/fstab
and enter the line:
/swap16GB none swap defaults 0 0
You can check to find any mistakes if you enter "$ sudo swapon -a" which will try to
activate all swaps listed in your /etc/fstab file.
Disable any unwanted swaps in your /etc/fstab file and reboot.
Note that some like to use /dev/random instead of /dev/zero.