Linux – Amazon Ec2 Linux still shows old Volume size even after increasing

amazon ec2amazon-ebscentoslinux

Initially i had EBS boot as AMI image with 10GB EBS volume.
Then i created new 20Gb EBS volume and then attached that to old instance and booted

Then i see that i still have 10GB mounted as /dev/xvda1

Then i follow this tut

http://blog.linuxacademy.com/linux/resizing-root-partition-on-linux-in-amazon-ec2/

i did this

sudo  resize2fs /dev/xvda1
resize2fs 1.41.12 (17-May-2010)
The filesystem is already 2620603 blocks long.  Nothing to do!

$ sudo su
[root@ip-]# df -m
Filesystem           1M-blocks      Used Available Use% Mounted on
/dev/xvda1               10077      7096      2470  75% /
none                       828         1       828   1% /dev/shm
/dev/xvdb2              144578        33    144545   1% /mnt/ephemeral

what to do next

This is my lsblk output

NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
xvda    202:0    0    20G  0 disk
`-xvda1 202:1    0    10G  0 part /
xvdb    202:16   0 149.1G  0 disk
|-xvdb1 202:17   0   7.9G  0 part [SWAP]
`-xvdb2 202:18   0 141.3G  0 part /mnt/ephemeral

Best Answer

It sounds like you created a new device (probably called /dev/xvdc). You'd have to create a filesystem on that then mount it.

UPDATE: You need to understand the relationship between the block device, the partition and the filesystem. The block device is the physical layout of the disk. Partitions are a way to carve up disks into logically-separated chunks. Filesystems are where your files actually go, there's generally a one-to-one relationship between partitions and filesystems. You expanded the physical disk:

xvda    202:0    0    20G  0 disk

... But your xvda1 partition is still 10G:

`-xvda1 202:1    0    10G  0 part /

If this wasn't AWS, you would just boot into a LiveCD and expand the partition. As it stands, there's probably no good way to expand that partition. Amazon does some magic with partitions and takes care of the tricky stuff when you create instances from your AMIs. You'll have to make an AMI, launch a new instance from that AMI, and specify the new size in the wizard.

Once the instance is running you'd expand the filesystem (again, not the same thing as the partition, which Amazon will extend for you magically).