This question already has an answer here:

Hello Ladies and Gents,

I apologize if the question isn't phrased as well as it should be; it's getting late and I've been staring at this screen for way too many hours after work. My core competency is Java. I really only dabble with server maintenance when I have to.

My question is basically the same as this guy's, although I hope I don't get smacked around by commentators as much as he did.

Created 100GB ec2 instance, but only shows 10GB?

I've created a RHEL6 server with Amazon Web Services (AWS) and selected a 100GB hard drive. However, when I bootup the system and look at the disk space, I get this:

Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      5.8G  2.0G  3.6G  35% /
tmpfs           1.8G     0  1.8G   0% /dev/shm

And like that previous guy, I tried resize2fs and received:

The filesystem is already 1572864 blocks long.  Nothing to do!

I was really hoping someone would expand upon the accepted answer:

Use fdisk to create a new partition
Create a filesystem using mkfs
Add the new partition into a convenient filesystem location using mount.
Update the /etc/fstab as appropriate.

Combined with a similar post, there have been ~3,200 views of this question over the last 2 years without a detailed answer. Additionally, the reams of documents I've read online haven't been helpful either. This is someone's chance to be an internet hero.

I really don't want to create a separate partition but rather have the main /dev/xvda1 take up the entire disk's space. In fact, the default Amazon Linux image does this very exact thing by default.

Thank you in advance.

* Update 1 *

Output of fdisk -l -u /dev/xvd

WARNING: GPT (GUID Partition Table) detected on '/dev/xvda'! The util fdisk doesn't support GPT. Use     GNU Parted.

Disk /dev/xvda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders, total 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Device Boot      Start         End      Blocks   Id  System
/dev/xvda1               1    20971519    10485759+  ee  GPT

Output of lsblk gave me

xvda    202:0    0  100G  0 disk 
└─xvda1 202:1    0    6G  0 part /

* Update 2 * The next thing I've tried is to create a snapshot of xvda1 and then create another 100GB volume from this snapshot. I then used the directions in this Amazon AWS link to use parted to create a 100GB partition.


I then switched the two hard drives so that my new 100GB was my boot disk. However, it appears my server refuses to now bootup and fails the instance checks. Back to the drawing board.

* Answer *

I finally figured out an answer, which had NOTHING to do with the "duplicate's" answer. Duplicate my rear end.

  • Create your RHEL instance. Go ahead and make the hard drive 100GB.
  • Once it gets done initializing, shut it down. Then create a snapshot of the hard drive.
  • Create a new volume from your snapshot. Make it 100GB also.
  • Attach the new hard drive to your instance. Leave it as the default /dev/sdf
  • Boot up your instance and ssh into it.
  • From the command line, run the following lines (minus the $) to remove and create a new 100GB partition. Excuse the formatting. This question's editor has gone bonkers.

$ parted
$ print
You will get a couple of warnings talking about extra space. Select the Fix It route
$ rm 1
$ unit GB
$ mkpart ext4 0 100%
$ set 1 boot on
$ print
You should see a 100GB+ system.

Shut down the system and detach the /dev/sdf drive. You should have only the /dev/sda1 drive attached. Boot your instance back up, SSH into it, and type 'df -h'. And what do you see?

Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       99G  2.0G   92G   3% /
tmpfs           1.8G     0  1.8G   0% /dev/shm

Drops the mic and walks off stage

* This is NOT a duplicate question *

Following the steps listed in the previous questions "answer" do not provide a sufficient explanation. I want a full disk, not a separate partition.

marked as duplicate by ceejayoz, MadHatter, Ward, Michael Lowman, fukawi2 Mar 4 '15 at 5:32

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Post the output of fdisk -l -u /dev/xvda to see how much space you actually have. – Daniel t. Mar 3 '15 at 3:54

lsblk will show you where your space is. Sometimes you just have to tweak LVM to get what you want.

lvextend -l +100%FREE /dev/mapper/whatever

If you are not using LVM you can run into trouble like having a swap partition in the way of growing your main partition. In this case you can just make a second partition and mount bind it over any folder in your main one, or you can move your swap and expand the main one...

I'm a LVM fan so I would use LVM to keep my options open... reading the man pages will best help you understand what and why but I hope this answer gets you a good start.

  • I think you forgot to hit your Enter key a time or two. :) – EEAA Mar 3 '15 at 4:36
  • Maybe I'll edit it later when I'm not using the mobile UI. – user1133275 Mar 3 '15 at 4:40
  • Can't use lvextend on RHEL6 from Amazon AWS. I get a no logical volume group name or such. From what I've read I can only extend LVM volumes if they were designated as such at creation time. – Will Lovett Mar 5 '15 at 0:08
  • I improved the formatting of the answer, thanks for it by the way – Djidiouf Aug 28 '15 at 6:37

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