Created
November 6, 2013 20:41
-
-
Save kstevens715/7343704 to your computer and use it in GitHub Desktop.
Create swap space of 2GB.
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
#!/usr/bin/env bash | |
# Exit on any error (non-zero return code) | |
set -e | |
# Create swapfile of 2GB with block size 1MB | |
/bin/dd if=/dev/zero of=/swapfile bs=1024 count=2097152 | |
# Set up the swap file | |
/sbin/mkswap /swapfile | |
# Enable swap file immediately | |
/sbin/swapon /swapfile | |
# Enable swap file on every boot | |
/bin/echo '/swapfile swap swap defaults 0 0' >> /etc/fstab |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment