EC2 Disk space not utilized fully

I have an EC2 instance. While launching i tried with disk storage space, like 16 GB.

In AWS console i see a new EBS volume been created of 16 GB and gets attached.

When i log into machine i can see the disk size being 16 GB but my partition is only 8 GB.

Df Command

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvde1      7.9G  1.5G  6.1G  20% /
tmpfs           1.9G     0  1.9G   0% /dev/shm

Fdisk Command:

$ sudo fdisk -l

Disk /dev/xvde: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 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: 0x00098461

    Device Boot      Start         End      Blocks   Id  System
/dev/xvde1   *           1        1045     8387584   83  Linux

lsblk

$ lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvde    202:64   0  16G  0 disk
└─xvde1 202:65   0   8G  0 part /

As per this SF post EC2 drive not EBS volume size i tried resizing my EBS volume.

sudo resize2fs /dev/xvde1

But am getting

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

When i tried deleting the partition and recreate it i couldn’t able to boot up the machine. How can utilize my entire disk space.

It will be better if i have a single partition utilizing my entire disk space.

Answer

Thanks Michael for your tip.

I followed this SO post with few changes mentioned below.

WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to switch off the mode (command ‘c’) and change display units to sectors (command ‘u’)

I was on CentOS. You have to switch off the DOS compatible mode. And continue with the steps.

Once that’s done i could able to run

sudo resize2fs /dev/xvde1

Attribution
Source : Link , Question Author : prasann , Answer Author : Community

Leave a Comment