Bug 574687 - Enhance libguestfs with partition+filesystem resize option
Enhance libguestfs with partition+filesystem resize option
Product: Virtualization Tools
Classification: Community
Component: libguestfs (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Richard W.M. Jones
Depends On:
  Show dependency treegraph
Reported: 2010-03-18 04:37 EDT by Dennis Krul
Modified: 2010-03-25 10:30 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-03-25 10:30:18 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Dennis Krul 2010-03-18 04:37:08 EDT
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):


How reproducible:


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)!
Comment 1 Richard W.M. Jones 2010-03-18 05:57:02 EDT
Upstream discussion / proposed virt-resize tool:

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.
Comment 2 Richard W.M. Jones 2010-03-23 04:45:19 EDT
Tool is ready for testing, see:

Comment 3 Richard W.M. Jones 2010-03-25 10:30:18 EDT
This is upstream now:
and available in Rawhide.

Thanks for suggestions and testing.

Note You need to log in before you can comment on or make changes to this bug.