You've run out of space on an EBS volume up at AWS and now you want to expand the drive. Expanding a drive on EC2 is relatively simple and is a procedure that comes up often. The steps are relatively straightforward especially if you have some background in VMWare.
These directions are designed for Windows 2008 or better, but they work equally as well for Linux or Windows 2003. For Windows 2003 you need to use diskpart.exe to expand the disk partition. For Linux you would most likely be using either LVM or resize2fs.
There are some basic requirements:
Basic Disks -- Disks can't be Dynamic as extending a partition is only supported on Basic disks. To expand a logical drive using Dynamic disks, you need to add a new volume to the EC2 instance and then span your volume to this new disk
Disk must be less than 1TB in size -- AWS Volume size maximum is 1TB. Over 1TB you need to switch to Dynamic, add another volume, and concatenate the logical volume across the two disks
For Windows 2003, the disk can't be the C: drive -- Windows 2008 or better support extending the C: partition. Windows 2003 does not. To resize C: on Windows 2003 you need to use special software like Parted Magic
The partition that you want to expand MUST be the last partition on the disk. Otherwise you are stuck using Parted Magic again.
Get a good backup of your data. You'll be resizing disk partitions so the risk of a complete disk wipe is certainly elevated.
Run chkdsk /f in Windows on the volume being expanded. This isn't a requirement but given the disk changes that you are about to make, a quick chkdsk is good idea.
Stop your Ec2 Instance
Note down the device information on how your volume is attached to the instance and the instance availability zone. In the example below the disk is attached to /dev/xdf and the availability zone is us-east-1a:
Take a snapshot of the volume you want to expand:
Wait until the snapshot is done being made. You can monitor porgress in the "Snapshots" pane
On the same menu as Step#3, detach the volume from the instance
Create a new volume from the snapshot. Resize the volume as needed. Make sure the Availability Zone matches the zone that the instance is in. See Step #2.
Attach the newly created volume to the instance. Use the same device name that you got in Step #2.
Start the EC2 Instance, login, and open Disk Manager
You should see that the disk has been resized and there is free space at the end of the disk. At this point the partition needs to be resized to use the additional free space
Right click on the partition and choose extend. Follow the default prompts to extend the partition to use up the remaining free space
Check that your files are present. You may experience some initial slugishness with the volume. This volume was created from a snapshot stored on S3. The data is being copied in the background from S3 to EBS. Once that copy is complete normal IO should return. The time for the copy is of course dependant on the amount of data.
Once you are happy with the new configuration, delete the original volume
I'm busy working on my blog posts. Watch this space!