[CentOS] Resize a VM: any risk involved ?

Thu Apr 8 16:35:21 UTC 2021
Simon Matter <simon.matter at invoca.ch>

> Hi,
>
> I'm currently fiddling with KVM, Proxmox and various VMs.
>
> I setup a very basic VM with a manual (fdisk) partitioning scheme: one
> /boot
> partition, one swap partition, and one root partition, the latter being
> the
> last partition and thus expandable).
>
> I'm starting with a reduced disk size (6 GB in total) and a minimal
> installation. The idea behind this approach is that I can clone this
> minimal VM
> and then eventually expand it to fit my needs.
>
> Here's how I expand the available disk size.
>
> First I increase the virtual disk in the hypervisor.
>
> Then I fire up the VM and do the following:
>
> # yum install cloud-utils-growpart
> # lsblk
> # growpart -v /dev/sda 3
> # resize2fs /dev/sda3
>
> Now here's my question (finally): is there any risk involved in this sort
> of
> operation? Or can it be performed on a production system without having to
> worry about data loss?

I'm often doing something similar but *not* with partitions. I have either
disk images or logical volumes on the KVM host which I grow and then use
"virsh blockresize" to adjust size. Then on the guest I only have to
resize the filesystem or in case using LVM on the guest, first "lvextend"
and then resize the filesystem.

Fiddling with partitions without the ability to reboot always scares me a
bit. That's why I prefer not to so it and therefore I have not used
"growpart".

BTW, are you not using XFS these days?

Regards,
Simon