Quick way to add more SWAP space on your server

To check the swap space used you can use “free -m“.

If for some reason you have a server with too little SWAP then there is a quick way to create a swap file and then use it for additional swap space on the server.

dd if=/dev/zero of=/opt/swapfile bs=1024 count=2048000
mkswap /opt/swapfile
swapon /opt/swapfile
swapon -s

And then we need to add the following to the /etc/fstab.

/opt/swapfile swap swap defaults 0 0

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.