Skip to content

Instantly share code, notes, and snippets.

@ArmaanMcleod
Last active August 29, 2020 12:40
Show Gist options
  • Save ArmaanMcleod/fbb830a3e92feb4116b65d6952e323b2 to your computer and use it in GitHub Desktop.
Save ArmaanMcleod/fbb830a3e92feb4116b65d6952e323b2 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ "$#" -ne 2 ] || [ $EUID -ne 0 ]; then
echo "usage: sudo ./azure-disk-setup.sh [device name] [mount point]"
exit 1
fi
DEVICE_NAME=$1
MOUNT_POINT=$2
parted "$DEVICE_NAME" --script mklabel gpt mkpart xfspart xfs 0% 100%
mkfs.xfs "${DEVICE_NAME}1"
partprobe "${DEVICE_NAME}1"
mkdir "$MOUNT_POINT"
mount "${DEVICE_NAME}1" "$MOUNT_POINT"
uuid=$(blkid "${DEVICE_NAME}1" -sUUID -ovalue)
echo "$uuid $MOUNT_POINT xfs defaults,nofail 1 2" | tee -a /etc/fstab
@ArmaanMcleod
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment