Skip to content

Instantly share code, notes, and snippets.

@mauricios
Last active November 10, 2016 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mauricios/71e69c8feccc9385c708a9a7095c3a52 to your computer and use it in GitHub Desktop.
Save mauricios/71e69c8feccc9385c708a9a7095c3a52 to your computer and use it in GitHub Desktop.
Creates a Swap file in Ubuntu 14.04, useful for increase memory in virtual machines
#!/bin/sh
# Creates swap file
sudo dd if=/dev/zero of=/swapfile bs=1G count=1 &&
sudo chmod 600 /swapfile &&
sudo mkswap /swapfile &&
sudo swapon /swapfile;
# Remove swap file
sudo swapoff /swapfile &&
sudo rm -rf /swapfile
@mauricios
Copy link
Author

mauricios commented Sep 27, 2016

This creates a 1Gb Swap partition file. You should have at least 1Gb free RAM on your system.

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