Tuesday, March 4, 2014

Resizing EBS Volumes for EBS Backed instances.

1. Go to the Instances management interface and stop the instance in question. Take note of the availability zone it currently resides in, as you will need that information later. Also where the Volume is mounted /dev/sdxx.
2. Go to the Volumes management interface, find the one being used by the instance (see the “attached to” column, it will have the instance’s name) and select the Take Snapshot option.
3. Go to the Snapshots management interface and find the newly created snapshot. Choose it and select the Create Volume option. Then, you must enter the new (increased) size and select the same availability zone as the EC2 instance.
4. Go to the Volumes management interface, find the OLD volume, choose it and select the Detach Volume from instance option. Then, find the NEW volume, choose it and select the Attach Volume to instance option. Here you select the instance you want to have the increased partition and The DEVICE MOUNT POINT TO  /dev/sdxx. 
5. After the new volume is attached, you go back to the Instances management interface and start the EC2 instance again. Wait for it to come back online and connect to it through SSH.
6. Login as root (sudo, etc) and run the df -h command to get a list of the partitions. Here you will see the new one, more likely mounted at “/dev/xvda1″. Notice that the system doesn’t report the correct (increased) size yet. To fix that you will have to extend the partition in order for it to cover the rest of the free space of the volume. To do so, simply run the command: “resize2fs /dev/xvda1″.

No comments:

Post a Comment