I just created an Amazon AWS EC2 instance running RHEL7
:
[root@ip-10-184-161-46 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.0 (Maipo)
[root@ip-10-184-161-46 ~]#
And even though I selected 10GB
as my storage capacity, for whatever reason I'm only seeing 6GB
that's available for me to use right away:
[root@ip-10-184-161-46 ~]# mount | grep xfs | grep -v selinux
/dev/xvda1 on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
[root@ip-10-184-161-46 ~]# df -h | grep xvda
/dev/xvda1 6.0G 2.2G 3.9G 37% /
[root@ip-10-184-161-46 ~]# fdisk -l /dev/xvda
Disk /dev/xvda: 10.7 GB, 10737418240 bytes, 20971520 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 label type: dos
Disk identifier: 0x0000b85c
Device Boot Start End Blocks Id System
/dev/xvda1 * 2048 12584959 6291456 83 Linux
[root@ip-10-184-161-46 ~]#
this is what I did:
[root@ip-10-164-175-246 ~]# fdisk -l /dev/xvda
Disk /dev/xvda: 10.7 GB, 10737418240 bytes, 20971520 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 label type: dos
Disk identifier: 0x0000b85c
Device Boot Start End Blocks Id System
/dev/xvda1 * 2048 12584959 6291456 83 Linux
/dev/xvda2 12584960 20971519 4193280 83 Linux
[root@ip-10-164-175-246 ~]# xfs_growfs /
meta-data=/dev/xvda1 isize=256 agcount=4, agsize=393216 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0
data = bsize=4096 blocks=1572864, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@ip-10-164-175-246 ~]# df -h | grep xvda
/dev/xvda1 6.0G 2.3G 3.8G 38% /
[root@ip-10-164-175-246 ~]#
Where are my other 4GB
? I thought running xfs_growfs /
will increase the size of my xfs
partition.
What am I doing wrong?
Funny, I just did exactly this the other day after finding my RHEL instance on EC2 only had 6GB or so of the 10GB space allocated to it...
The problem here is that you created a second partition.
Instead, you should resize the first partition.
So, you will use
fdisk
to delete the second partition, then delete and re-create the first partition at the same time. Thefdisk
default values will cause it to fill the disk (and be correctly aligned).Start
fdisk
and delete the partition:Now re-create the partition with all default values, which will maximize its size:
Save the new partition table:
When you reboot, the filesystem should automatically be resized for you by
cloud-init
. If not, you can usexfs_growfs /
to grow the filesystem manually.You've divided your 10GB disk, xvda, into two partitions: xvda1 is 6GB and xvda2 is 4GB. So your other 4GB is in xvda2, and you can mount it somewhere if you want to use it.