exact volume not showing in aws centos ec2

Hello techrunnr readers, this document deals with issue “exact volume not showing in aws centos ec2”.

Here I have created an AWS Ec2 centos machine of 30Gb root hard disk. when I log in and check the server is was showing 6GB. Here is the method which I followed to solve this issue.

You Need root access to the server.


$ lsblk
xvda 202:0 0 30G 0 disk
└─xvda1 202:1 0 6G 0 part / 
$ sudo su
# yum install gdisk
# gdisk /dev/xvda
Command (? for help): p
Disk /dev/xvda: 62914560 sectors, 30.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 1CB06BCB-6003-4826-8208-C368357EAEDE
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 20971486
Partitions will be aligned on 2048-sector boundaries
Total free space is 8388541 sectors (4.0 GiB)

Number Start (sector) End (sector) Size Code Name
1 2048 12584959 6.0 GiB EF00

From the above output, you can see I used 30GB HDD but only 6GB is available.

I then delete the partition table information and create a new partition. I accepted the defaults and when prompted for the ‘Hex code or GUID’ I input EF00 which I found when I printed out the disk information above.

Command (? for help): x

Expert command (? for help): g
Enter the disk's unique GUID ('R' to randomize): 1CB06BCB-6003-4826-8208-C368357EAEDE
The new disk GUID is 1CB06BCB-6003-4826-8208-C368357EAEDE

Expert command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING

Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/xvda.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot.
The operation has completed successfully.

I then place gdisk into expert mode and set the unique GUID back to the original value that I got from the first print above. Finally write the new partition information to disk. At this point I rebooted and after reconnecting to the instance I now have access to all 30G.

$ lsblk
xvda 202:0 0 30G 0 disk
└─xvda1 202:1 0 30G 0 part / 

$ df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/xvda1 ext4 30G 2.1G 26G 8% / 
tmpfs tmpfs 498M 0 498M 0% /dev/shm

© 2018, Techrunnr. All rights reserved.

Questions Answered
Articles Written
Overall Points
Categories: AWSLinux

Prabhin Prabharkaran

He is Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!!

Leave a Reply

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.