[CentOS] Troubles expanding file system.

Fri Sep 3 05:28:33 UTC 2021
Simon Matter <simon.matter at invoca.ch>

Hi Jeff,

> I realized I was still on receiving the daily digest format last night, so
> I have probably screwed up the threading on this now.  If you cc me
> directly maybe I can maintain the future threading.
> Ok, looking at Parted it looks like the resize (or resizepart) command
> will be what I will need.  But that doesn't appear to help recognize the
> expanded disk, so I think I need something before that.  That is what I
> thought the echo 1 > rescan would do for me.

I'm not sure what your current state is but I'd like to point out what I
usually do to online resize disks on KVM hosts/guests.

After expanding the disk image/logical volume, let the quest know it has
changed. To do so, run like this on the host:

virsh blockresize db01 /var/lib/libvirt/images/db01.var.img 7516192768B


virsh blockresize db01 vdb 7516192768B

Note: I'm using bytes (B) as unit to make very sure it's correct!

After doing so, you should see that disk size has changed on the guest, in
syslog or with dmesg.

Now you can modify partition tables or pvresize. After that, resize the
fillesystems with resize2fs or xfs_growfs.

That's all possible while the guest is online with one exception outlined

There is one thing that I couldn't find a solution for no matter what I
tried: When the root/boot disk of the guest is being resized, it's not
possible to modify and reread the new partition table without reboot.