Created
October 2, 2011 00:01
-
-
Save zircote/1256841 to your computer and use it in GitHub Desktop.
Create and Attach EBS volumes for 1TB RAID 1+0
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 | |
| EC2_INSTANCE_ID=`curl -s http://169.254.169.254/latest/meta-data/instance-id` | |
| EC2_AVAIL_ZONE=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone` | |
| EC2_REGION="`echo \"$EC2_AVAIL_ZONE\" | sed -e 's:\([0-9][0-9]*\)[a-z]*\$:\\1:'`" | |
| EBS_SIZE=256 | |
| for x in {1..8}; do \ | |
| ec2-create-volume -s $EBS_SIZE -z $EC2_AVAIL_ZONE ; \ | |
| done > /tmp/vols.txt | |
| (i=0; for vol in $(awk '{print $2}' /tmp/vols.txt); \ | |
| do i=$(( i + 1 )); ec2-attach-volume $vol -i $EC2_INSTANCE_ID -d /dev/sdh${i}; \ | |
| ec2-create-tags $vol --tag Name=$EC2_INSTANCE_ID\ /dev/sdh${i} | |
| done) | |
| ec2-describe-volumes | grep $EC2_INSTANCE_ID |
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 | |
| mdadm --create -l10 -n8 /dev/md0 /dev/sdh* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment