Description of problem: When resizing a guest image/lv, it's difficult to enlarge the contained partitions and filesystems from the hypervisor environment in an easy, scriptable fashion. It would be great if libguestfs/guestfish was able to assist here. Because guestfish can use native tools it is in an excellent position to facilitate this. Version-Release number of selected component (if applicable): N/A How reproducible: N/A Steps to Reproduce: 1.Enlarge a guest image (using lvresize for example) 2.Try to enlarge the contained partitions and filesystems 3.Observe that this is quite difficult to do :) Actual results: Expected results: 1.Enlarge a guest image 2.Run a magic guestfish command to automatically enlarge the partition/filesystem to maximum size Additional info: This will probably only work if the guest image has only one partition. Or otherwise you can only enlarge the last partition. The magic command should detect the filesystem type of the partition (or provide an option to set it) and call the correct command to resize it. Or otherwise fail if the filesystem type is not supported. - If the partition contains a ext(2|3|4) partition, use resize2fs - If the partition contains a lvm pv, use pvresize. Support for ntfs and ufs2 would be a nice additional feature. Thanks for looking into this. This would greatly enhance the usability of guestfish (at least for us)!
Upstream discussion / proposed virt-resize tool: https://www.redhat.com/archives/libguestfs/2010-March/msg00042.html Note that moving partitions in-place is significantly hard and error-prone, and so the proposed tool creates a new disk image each time. The proposed workflow (with LVs) would look something like this: virsh shutdown Guest lvrename /dev/VG/Guest /dev/VG/Guest_orig lvcreate -L 10G -n Guest VG virt-resize --expand /some/fs /dev/VG/Guest_orig /dev/VG/Guest virsh start Guest # started with resized disk image # test the guest still boots and works before ... lvremove /dev/VG/Guest_orig You need to provision the host with enough free disk space to store at least one extra guest's disk image.
Tool is ready for testing, see: https://www.redhat.com/archives/libguestfs/2010-March/msg00115.html
This is upstream now: http://git.annexia.org/?p=libguestfs.git;a=commit;h=def627e4daf2d32cebf91f5e01f44a0b7e512129 and available in Rawhide. Thanks for suggestions and testing.