Tuesday, July 17, 2012

AWS creating larger boot volume

Amazon AWS when using the GUI to create instances gives you 8GB EBS volumes. On the current UI there is no way to increase this size. To create a bigger EBS volume, use the ec2-run-instances command. You will have to download the amazon api tools available here: http://aws.amazon.com/developertools/351/ then you have to set environment variables to get the tools to work: export EC2_HOME=/Users/dc/.ec2 export PATH=$PATH:$EC2_HOME export EC2_PRIVATE_KEY=/Users/dc/.ec2/pk-T34QYHCDFZ7X2PYOESTIDSxx.pem export EC2_CERT=/Users/dc/.ec2/cert-T34QYHCDFZ7X2PYOESTIDSxxxxxxxxxx.pem To create a bigger volume write down the AMI and snapshot ID of the smaller instance you just created and replace them in the ec2-run-instances command below: ec2-run-instances ami-349b495d -k pemfile -t m2.2xlarge -z "us-east-1d" -b /dev/sda1=snap-c4816dbf:300:true -g default 1) your keypair file name ends in a .pem extension. Mine was named pemfile.pem, leave off the pem extension in the argument list. The error messages you get if you leave the extension on won't make sense. 2) this instance has a 300gb volume. When the instance is created you still have to resize the volume to get access to all the space. Before: ubuntu@ip-10-224-114-177:~$ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 7.9G 730M 6.8G 10% / none 1.9G 112K 1.9G 1% /dev none 1.9G 0 1.9G 0% /dev/shm none 1.9G 48K 1.9G 1% /var/run none 1.9G 0 1.9G 0% /var/lock none 1.9G 0 1.9G 0% /lib/init/rw /dev/sdb 394G 199M 374G 1% /mnt Grow the partition using ubuntu@ip-10-224-114-177:~$ sudo resize2fs /dev/sda1 After: ubuntu@ip-10-224-114-177:~$ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda1 82569904 756660 77619864 1% / none 1894544 112 1894432 1% /dev none 1976428 0 1976428 0% /dev/shm none 1976428 48 1976380 1% /var/run none 1976428 0 1976428 0% /var/lock none 1976428 0 1976428 0% /lib/init/rw /dev/sdb 412814512 203156 391641580 1% /mnt

No comments:

Post a Comment