Created
November 11, 2014 00:54
-
-
Save alex2006hw/074581c94e1c755ff650 to your computer and use it in GitHub Desktop.
script to partition disk for swap on boot up using /etc/rc.local
This file contains 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
# sfdisk -d /dev/xvdb to obtain disk geometry output to use below | |
# | |
# Format ephemeral disk into partition for swap on /dev/xvdb2 | |
sfdisk /dev/xvdb <<EOF | |
unit: sectors | |
/dev/xvdb1 : start= 2048, size=209715200, Id=83 | |
/dev/xvdb2 : start=209717248, size=629073920, Id=82 | |
/dev/xvdb3 : start= 0, size= 0, Id= 0 | |
/dev/xvdb4 : start= 0, size= 0, Id= 0 | |
EOF | |
mkswap /dev/xvdb2;swapon -a | |
# Some apps like to write PID info into /var/run | |
# change /var/run to support writing as non-root user | |
[ ! -d /run ] && (/bin/mkdir /run) | |
chmod 777 /run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment