0

New Cloud Compute VM instance with the Centos 7 image. Even though I picked 100GB disk size the Centos image had 10GB boot disk. I have tried extending the /dev/sda2 to utilize the unused space but so far I am not successful with xfs_growfs / command.

Current partitions and mountpoints:

$ lsblk -f

NAME   FSTYPE LABEL UUID                                 MOUNTPOINT
sda                                                      
├─sda1 vfat         BC59-BBE8                            /boot/efi
└─sda2 xfs    root  af3a1ad4-b9d0-43dd-a61d-907efeaac16c /
loop0  ext3         02893f9e-1028-4f5a-bde4-9d7e25595473 /var/tmp

and

$ sudo parted
(parted) print free
Model: Google PersistentDisk (scsi)
Disk /dev/sda: 107GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number  Start   End     Size    File system  Name                  Flags
        17.4kB  1049kB  1031kB  Free Space
 1      1049kB  211MB   210MB   fat16        EFI System Partition  boot
 2      211MB   10.7GB  10.5GB  xfs
        10.7GB  107GB   96.6GB  Free Space

As instructed in other posts, I try xfs_growfs to add 96.6GB space to sda2:

$ sudo xfs_growfs /

meta-data=/dev/sda2              isize=512    agcount=4, agsize=642432 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=2569728, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

which is same as before. I am sure I am missing something. Appreciate your help.

1 Answers1

0

you can't grow the filesystem until you have grown/resized the underlying partition.

BACK UP FIRST as there is an element of risk, but I'm gparted you want to delete the last partition, then recreate it with the same starting block but larger size, ensuring you keep the same partition twice.

Once you have done that, you need to reboot or reload the partition info and you should then be able to resize the filesystem.

davidgo
  • 6,222
  • 3
  • 23
  • 41
  • It's a new install not much to lose, but gparted does not let me do these functions without unmounting the disk which I cannot do because it is in use. – OldSkoolDev Oct 30 '19 at 17:08
  • OK with the help of more Google search I now see what you mean. I deleted the main partition using fdisk (/dev/sda2/) and then I created a new partition with default values (which was the maximum available disk space). Since the created partition number was same as deleted one it was basically resizing the partition. fdisk was able to see /dev/sda2 as 100GB. After a reboot, I used xfs_growfs -d / to make the space available for the filesystem. – OldSkoolDev Oct 30 '19 at 18:04