swap

First create a 2 GB file

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.

fallocate -l 8G /swapfile

Make it swap

mkswap /swapfile
chmod 0600 /swapfile
swapon /swapfile

Add it to /etc/fstab

echo "/swapfile swap swap defaults 0 0" >> /etc/fstab

swapon

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *