Create swap on VPS

Posted on Posted in IT

Tested on DigitalOcean Debian8.

Swap creation:

dd if=/dev/zero of=/swapfile bs=1024 count=512k
 mkswap /swapfile
 swapon /swapfile
 echo -e 'n/swapfile swap swap defaults 0 0' >> /etc/fstab
 reboot
 swapon -s
 free

That did not work with Azure debian 8 clean install.

But you can do it that way:

dd if=/dev/zero of=/swapfile bs=1024 count=512k
 mkswap /swapfile
echo -e 'n/swapfile swap swap defaults 0 0' >> /etc/fstab
 reboot
 swapon -s
 free

Leave a Reply