Skip to content

Instantly share code, notes, and snippets.

@dergachev
Created September 12, 2013 17:53
Show Gist options
  • Save dergachev/6541373 to your computer and use it in GitHub Desktop.
Save dergachev/6541373 to your computer and use it in GitHub Desktop.
Increase swap on Ubuntu

My Vagrant Ubuntu VM just died while running a memory intensive command.

Its output just says "Killed".

vim /var/log/syslog confirms that the machine ran out swap and the process was killed.

free -m shows we have 768M (or so) swap space.

sudo swapon -s shows that we have a single swap partition at /dev/mapper/precise64-swap_1

The steps to temporarily add an extra swap partition:

sudo fallocate -l 3G /swapfile
sudo chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile

See http://askubuntu.com/a/238068 for more info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment