Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an EC2 instance which I created a 500GB EBS volume for. Unfortunately, the EC2 instance shows only 8GB available.

I have only one drive, which is right.

[root@ip-10-244-134-250 ~]# ls -la /dev/x*
brw-rw---- 1 root disk 202, 1 Aug  7 08:54 /dev/xvda1

But, that drive is only 8GB

[root@ip-10-244-134-250 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1            8.0G  1.3G  6.7G  16% /
tmpfs                 3.7G     0  3.7G   0% /dev/shm

But, fdisk and /proc/partitions both show correct size

[root@ip-10-244-134-250 ~]# fdisk -l

Disk /dev/xvda1: 536.9 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/xvda1 doesn't contain a valid partition table

[root@ip-10-244-134-250 ~]# cat /proc/partitions 
major minor  #blocks  name

 202        1  524288000 xvda1

Any help would be greatly appreciated, thanks.

share|improve this question
add comment

2 Answers

up vote 12 down vote accepted

If the root file system is ext3 or ext4, then run:

sudo resize2fs /dev/xvda1

If the root file system is xfs (less common), then run:

sudo xfs_growfs /

You can omit "sudo" if you are logged in as root.

These commands should be run while the system is running and the file system is mounted.

It's standard for EBS volumes to not contain a partition table. The EBS volume is generally formatted as a file system in its entirety without partitions.

share|improve this answer
1  
Irritates me when people vote you down with no explanation. Anyway, this worked beautifully. Thanks very much! –  Christian Aug 7 '12 at 11:32
1  
/me shrugs and moves on with life :-) Glad to help. Here are a couple related articles I've written: alestic.com/2009/12/ec2-ebs-boot-resize alestic.com/2010/02/ec2-resize-running-ebs-root –  Eric Hammond Aug 7 '12 at 22:21
1  
Note that the cloud-init package included in Ubuntu AMIs automatically runs resize2fs on boot. I'm surprised this isn't in Amazon Linux since they are also using cloud-init. –  Eric Hammond Aug 7 '12 at 22:24
add comment

Resize the filesystem on the EBS volume. If you're running ext3 (which is usually the default), you can just run e2resize /dev/xvda1.

share|improve this answer
    
The volume first needs to be offline and dis-mounted. –  Farhan Aug 7 '12 at 9:12
1  
Not with any even vaguely modern Linux distribution. Online expansion of ext3 filesystems has been supported for years. –  womble Aug 7 '12 at 9:15
    
Thanks womble, I am using the aws distro and e2resize is not on there. Its not in any yum repo's either. Should I just get the source and build it myself? –  Christian Aug 7 '12 at 11:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.