Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
sudo su

 


Create a swap file with 4 blocks of 1GB:

Code Block
languagebash
dd if=/dev/zero of=/mnt/swap bs=1G count=4

...


Enable the file for swap usage:

Code Block
languagebash
chmod 600 /mnt/swap
mkswap /mnt/swap
swapon /mnt/swap

 


Persist the swap file:

  • add to /etc/fstab (bottom):
Code Block
languagebash
/mnt/swap 	none 	swap 	sw 	0 	0
  • add to /etc/sysctl.conf (bottom):
Code Block
languagebash
vm.swappiness=30


> Detailed procedure here