Skip to content

Instantly share code, notes, and snippets.

@giskou
Last active February 13, 2017 14:30
Show Gist options
  • Save giskou/ce32707fc9c0f100cc2f64455432b873 to your computer and use it in GitHub Desktop.
Save giskou/ce32707fc9c0f100cc2f64455432b873 to your computer and use it in GitHub Desktop.
Set up disk
#!/usr/bin/env bash
mkdir $2
echo "Partitioning $1"
echo -e "n\np\n1\n\n\nw" | fdisk "$1"
echo "Formating $1"
mkfs.ext4 "$1"1
UUID=`blkid | grep "$1" | egrep -o '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}'`
echo "UUID=$UUID $2 ext4 defaults 1 2" >> /etc/fstab
echo "Mounting $1 on $2"
mount $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment