« Annotated JSHint Configuration File | Main | Books »

AWS EC2 EBS Partition Resize

I recently noticed I was getting low on space on one of my EBS volumes I mount on my EC2 server. After doing some research (aka Googling) it seemed like a simple procedure: umount, snapshot, create volume, resize, and mount. I even found a concise page that detailed resizing an EBS volume with sample commands. However when I got to the resize step I ran into an error along the lines of "The filesystem is already XXX blocks long. Nothing to do!". Turns out I didn't mount the complete EBS volume as a drive but instead partitioned it. The snapshot and create volume steps had increased the size of the EBS volume but not my partition. Without a graphical interface the prevailing recommendation to use gparted didn't help. Thankfully I stumbled upon another blog posting about resizing partitions using fdisk without losing data. While that post dealt with another virtual server service the same basic principles applied. After carefully deleting and recreating the partition on my EBS volume keeping the starting sector and file type the same resize2fs finally worked and I was off to the races. In retrospect the partition table hacking makes sense that it would work but isn't something I would have thought to try.

Tags: aws ebs ec2 neophi