swap
First create a 2 GB file
1 |
dd if=/dev/zero of=/swapfile bs=1M count=4096 |
For 8 GB, use count=8192. You can also use fallocate command instead of dd.
1 |
fallocate -l 8G /swapfile |
Make it swap
1 2 3 |
mkswap /swapfile chmod 0600 /swapfile swapon /swapfile |
Add it to /etc/fstab
1 |
echo "/swapfile swap swap defaults 0 0" >> /etc/fstab |