Skip to content

Instantly share code, notes, and snippets.

@camme
Last active November 14, 2018 08:35
Show Gist options
  • Save camme/bee6e573e45337ec36c65a50bda1ce30 to your computer and use it in GitHub Desktop.
Save camme/bee6e573e45337ec36c65a50bda1ce30 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
file -s /dev/xvdb
mkfs -t ext4 /dev/xvdb
mkdir /data
mount /dev/xvdb /data
cp /etc/fstab /etc/fstab.orig
UUID=$(file -s /dev/xvdb | grep -E -o '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}')
echo "UUID=${UUID} /data ext4 defaults,nofail 0 2" >> /etc/fstab
umount /data
mount -a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment