Created
September 19, 2013 00:08
-
-
Save rberrelleza/6617514 to your computer and use it in GitHub Desktop.
Mount AWS volume on Ubuntu
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/bash | |
if [[ -z `fdisk -l | grep /dev/xvdb` ]];then | |
mkdir -p -m 755 /data | |
result=$(ec2-create-volume --size 100 --availability-zone \$AVAILABILITY_ZONE --region \$REGION_ID) | |
ec2-attach-volume --region \$REGION_ID $volume -i \$INSTANCE_ID -d /dev/xvdb | |
while [[ -z `fdisk -l | grep /dev/xvdb` ]]; do sleep 1; done | |
mkfs.ext4 /dev/xvdb | |
echo "/dev/xvdb /data auto noatime 0 0" | tee -a /etc/fstab | |
reboot | |
exit 100 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment