Bug 574687 - Enhance libguestfs with partition+filesystem resize option
Enhance libguestfs with partition+filesystem resize option
Status: CLOSED RAWHIDE
Product: Virtualization Tools
Classification: Community
Component: libguestfs (Show other bugs)
unspecified
All Linux
low Severity medium
: ---
: ---
Assigned To: Richard W.M. Jones
:
Depends On:
Blocks:
  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:
Environment:
Last Closed: 2010-03-25 10:30:18 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
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):

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

https://www.redhat.com/archives/libguestfs/2010-March/msg00115.html
Comment 3 Richard W.M. Jones 2010-03-25 10:30:18 EDT
This is upstream now:
http://git.annexia.org/?p=libguestfs.git;a=commit;h=def627e4daf2d32cebf91f5e01f44a0b7e512129
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.