Last active
August 29, 2020 12:40
-
-
Save ArmaanMcleod/fbb830a3e92feb4116b65d6952e323b2 to your computer and use it in GitHub Desktop.
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
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
MSDN docs: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/attach-disk-portal