Bug 574687 - Enhance libguestfs with partition+filesystem resize option
Summary: Enhance libguestfs with partition+filesystem resize option
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libguestfs
Version: unspecified
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-03-18 08:37 UTC by Dennis Krul
Modified: 2010-03-25 14:30 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-03-25 14:30:18 UTC
Embargoed:


Attachments (Terms of Use)

Description Dennis Krul 2010-03-18 08:37:08 UTC
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 09:57:02 UTC
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 08:45:19 UTC
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 14:30:18 UTC
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.