Created
March 17, 2017 20:14
-
-
Save anvol/c17ce5d8cb94e0fb7c3ae61ece8d64ff to your computer and use it in GitHub Desktop.
This file contains hidden or 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/sh -x | |
# Script usage example | |
# sudo sh azure-disk.sh /dev/sdc /datadisk | |
DEVICE="$1" | |
MOUNT_DIR="$2" | |
sfdisk $DEVICE << EOF | |
start=2048, type=83 | |
EOF | |
mkfs -t ext4 "${DEVICE}1" | |
mkdir -p "${MOUNT_DIR}" | |
mount "${DEVICE}1" "${MOUNT_DIR}" | |
devUUID=$(blkid -o value -s UUID ${DEVICE}1) | |
cp /etc/fstab /etc/fstab.backup | |
echo "UUID=${devUUID} ${MOUNT_DIR} ext4 defaults,nofail 1 2" >> /etc/fstab | |
chmod go+w ${MOUNT_DIR} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment