Labels

Friday, 1 September 2017

How to create swap in vps

Setup SWAP

It is required especially on a system with limited memory. I am setting up a 4GB swap, which may be overkill but it’s the most common swap sized used in most guides so ill keep it at that.
dd if=/dev/zero of=/mnt/myswap.swap bs=1M count=4000
mkswap /mnt/myswap.swap
swapon /mnt/myswap.swap
Now let’s add it into fstab so it’ll activate at boot.
nano /etc/fstab
Add the following line at the end of the file.
Quote:
 /mnt/myswap.swap none swap sw 0 0
Should look like this:
[Image: jujuBxG.png]
Ctrl+O to save, and Ctrl+X to exit the nano editor.
Now your swap is setup.