Site Tools


linux:general:swap

This is an old revision of the document!


Swap

What is Swap?

Create a (temp.) swapfile and add it to swap

Create a swapfile with blocksize 1024 and 2GB

dd if=/dev/zero of=/swap/swapfile bs=1024 count=2M
Format the file and set permissions
mkswap /swap/swapfile
chown root:root /swap/swapfile
chmod 600 /swap/swapfile
Add the swapfile to swap
swapon /swap/swapfile

Remove a swapfile from swap

Turn off the swapfile (used swap will be moved to other swap or memory, might take a while)

swapoff /swap/swapfile



linux/general/swap.1534929979.txt.gz · Last modified: 2018/08/22 11:26 by lunetikk