Last active
November 10, 2016 15:39
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This creates a 1Gb Swap partition file. You should have at least 1Gb free RAM on your system.