0

I created a t2.micro instance from rhel7 ami-f7f03d80 ami, with a 39gb gp2 xfs_ebs storage, and have a 6gb / xfs filesystem, and a 24gb of free space. I am trying to use xfs_growfs -d / for resizing a partition, and it says data size unchanged, skipping. when i'm specifying -D 2572864 to xfs_growfs, it says data size 2572864 too large, maximum is 1572864. looks like i need to resize a partition first, and then resize a filesystem, but i can't do that on a mounted fs. I could pack fdisk and xfs_growfs to initrd, and boot from it, but it seems too hard) It seems like i missed something, and it could be done other way. Thanks.

2 Answers2

1

It'll feel a little scary (take a snapshot first) but:

fdisk /dev/YOURDEVICE

delete your partition, create a new partition taking the whole disk, write changes, reboot.

You should see the whole drive after that.

Baby Groot
  • 4,637
  • 39
  • 52
  • 71
Paul Jones
  • 11
  • 1
  • I had to run `xfs_growfs /dev/sda1` afterwards so that `df -h` would update. This worked perfectly on my 1 partition root disk. – Ray Foss Oct 17 '16 at 15:25
1

I have incressed my root partion space by gdisk on RHEL 7

1) yum -y install gdisk

2) sudo gdisk /dev/xvda

Delete all the partions

3)

Command (? for help): o This option deletes all partitions and creates a new protective MBR. Proceed? (Y/N): Y

4) Use the n command to create a new partition entry for each partition on the device.

Command (? for help): n Partition number (1-128, default 1): 1 First sector (34-209715166, default = 2048) or {+-}size{KMGTP}: 2048 Last sector (2048-209715166, default = 209715166) or {+-}size{KMGTP}: 4095 Current type is 'Linux filesystem' Hex code or GUID (L to show codes, Enter = 8300): EF02 Changed type of partition to 'BIOS boot partition'

Command (? for help): n Partition number (2-128, default 2): 2 First sector (34-209715166, default = 4096) or {+-}size{KMGTP}: 4096 Last sector (4096-209715166, default = 209715166) or {+-}size{KMGTP}: 209715166 Current type is 'Linux filesystem' Hex code or GUID (L to show codes, Enter = 8300): 0700 Changed type of partition to 'Microsoft basic data'

5) Use the w command to write the changes to the device and exit.

Expert command (? for help): w

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

Do you want to proceed? (Y/N): Y OK; writing new GUID partition table (GPT) to /dev/xvda. The operation has completed successfully.

6) Reboot the system 7) After reboot you can see your /root partion size increassed

Bastian
  • 11
  • 2