Swap memory on low resource servers
Contents
- The commands
- Comments
Here are a few commands I have in my notes for adding swap memory on low resource Linux servers. I've used these on low end VPS's like the cheaper offerings by Amazon Lightsail.
The commands
sudo dd if=/dev/zero of=/swapfile bs=1M count=6114
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo echo '/swapfile swap swap defaults 0 0' | sudo tee --append /etc/fstab
sudo swapon -a