Skip to content

Instantly share code, notes, and snippets.

@wayneeseguin
Forked from seeingidog/gist:1222850
Created September 19, 2011 12:31
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 wayneeseguin/1226403 to your computer and use it in GitHub Desktop.
Save wayneeseguin/1226403 to your computer and use it in GitHub Desktop.
# bash based sh version
# partition for swap
if [[ "${MACHTYPE%%-*}" == 'x86_64' ]] # where was '$(arch)' comming from?
then
SWAPSIZE=$[$(free -m | awk '/^Mem:/{print $2}')*2]
if (( SWAPSIZE > 4096 ))
then
SWAPSIZE=4096
fi
sfdisk -uM /dev/sdb << EOF
,$SWAPSIZE,S
,,L
EOF
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment