I have a guest which has a 10G root disk as /dev/vda, and I would like to expand the root disk from 10G to 15G to offer more room to the /var filesystem.
The typical method would be the following:
- shutdown the guest
- find the backing store on the host (in this case it's a LVM logical volume)
- copy the LV for backup (lvcreate --name LVNew --size=10G; dd if=LVOld of=LVNew;)
- expand the LV (lvresize --size=+5G LVOld;)
- use kpartx on the host (or start the guest) and use parted to expand the guest disk parition
- expand the guest physical volumes (pvresize /dev/vda2), logical volumes (lvresize), and filesystems (resize2fs)
But this can be both automated and generalized with libvirt and libguestfs-tools. These tools provide a common vocabulary across many different storage back-ends such as LVM, iSCSI, file, NFS, etc. Let's see how that works.
The state of virtualization on Fedora moves fast. The following is based on a Fedora 13 host running libvirt-0.8.2-1.fc13.x86_64 and libguestfs-tools-1.6.2-1.fc13.4.x86_64.