Skip to content

Instantly share code, notes, and snippets.

@tolleiv
Created June 24, 2016 15:59
Show Gist options
  • Save tolleiv/c1e274d5bf222227f97e75ce433b1877 to your computer and use it in GitHub Desktop.
Save tolleiv/c1e274d5bf222227f97e75ce433b1877 to your computer and use it in GitHub Desktop.
Small script which provides fdisk with the proper parameters without leaving the necessary documentation out
sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << EOF | fdisk ${1}
o # clear the in memory partition table
n # new partition
p # primary partition
1 # partition number 1
# default - start at beginning of disk
# default, extend partition to end of disk
t # change a partition's system id
83 # Linux partition
p # print the in-memory partition table
w # write the partition table
q # and we're done
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment