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 /tmp/swapfile
chmod 600 /swap/swapfile
Add the swapfile to swap swapon /tmp/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/swap



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