Montag, 15. September 2014

Creating a Swap file and making it permanent (tested in Ubuntu 14.04)

This creates a 2 GB Swap file. You can change this in the first line and write 4G instead of 2G for a 4 GB Swap for example.

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo nano /etc/fstab    ->   add at bottom: /swapfile   none    swap    sw    0   0

About / Why / Disclaimer

I often don't remember the commands I need. Also I have different machines I have to use these commands on. This blog helps me to access the commands from anywhere. May it help others too.

Disclaimer: I am not taking any responsibility for whether these commands work or harm your system!