Bug 1139582 - virt-builder is unable to resize XFS root filesystems
Summary: virt-builder is unable to resize XFS root filesystems
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libguestfs
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-09 09:07 UTC by Richard W.M. Jones
Modified: 2014-09-17 10:02 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-09-09 16:13:55 UTC
Embargoed:


Attachments (Terms of Use)

Description Richard W.M. Jones 2014-09-09 09:07:51 UTC
Description of problem:

An internal RHEL 7.0 virt-builder image that we use has an XFS
root filesystem (as this is the default on RHEL 7).  However
virt-builder is unable to resize it:

$ virt-builder rhel-7.0 --size=20G
$ virt-df -h -a rhel-7.0.img
Filesystem                                Size       Used  Available  Use%
rhel-7.0.img:/dev/sda1                    488M        56M       397M   12%
rhel-7.0.img:/dev/sda3                    4.5G       756M       3.8G   17%

Note that /dev/sda3 has not been resized.

$ ll rhel-7.0.img
-rw-r--r--. 1 rjones rjones 21474836480 Sep  9 10:01 rhel-7.0.img
$ virt-filesystems --all --long -h -a rhel-7.0.img
Name       Type        VFS   Label  MBR  Size  Parent
/dev/sda1  filesystem  ext4  -      -    512M  -
/dev/sda2  filesystem  swap  -      -    1.0G  -
/dev/sda3  filesystem  xfs   -      -    18G   -
/dev/sda1  partition   -     -      83   512M  /dev/sda
/dev/sda2  partition   -     -      82   1.0G  /dev/sda
/dev/sda3  partition   -     -      83   18G   /dev/sda
/dev/sda   device      -     -      -    20G   -

Notice that the container of /dev/sda3 is 18G.

Resizing other filesystem types (eg. ext4) works fine.

Version-Release number of selected component (if applicable):

libguestfs 1.27.39

How reproducible:

100%

Steps to Reproduce:
1. See above.

Comment 1 Richard W.M. Jones 2014-09-09 16:13:55 UTC
This turned out to be because we'd not implemented xfs_growfs
in virt-resize.  This is implemented now, so virt-builder will
expand the RHEL 7.0 partition to full size:

$ virt-builder rhel-7.0 --size=20G
[   3.0] Downloading: http://***/builder/rhel-7.0.xz
[   4.0] Planning how to build this image
[   4.0] Uncompressing
[  34.0] Resizing (using virt-resize) to expand the disk to 20.0G
[  79.0] Opening the new disk
[  84.0] Setting a random seed
[  84.0] Setting passwords
Setting random password of root to bYDcouj5i7I6MC6f
[  85.0] Finishing off
                   Output file: rhel-7.0.img
                   Output size: 20.0G
                 Output format: raw
            Total usable space: 19.0G
                    Free space: 18.1G (95%)
$ virt-df -a rhel-7.0.img -h
Filesystem                                Size       Used  Available  Use%
rhel-7.0.img:/dev/sda1                    488M        56M       397M   12%
rhel-7.0.img:/dev/sda3                     18G       757M        18G    4%

Fixed in:

https://github.com/libguestfs/libguestfs/commit/163eb3b7a1921fe675f5a85d5dc28692d5e03bda

in libguestfs >= 1.27.42.

Comment 2 James (purpleidea) 2014-09-09 17:22:54 UTC
Well thanks! That was fast...

I will test as soon as I get a new virt-builder.

Cheers,
James

Comment 3 James (purpleidea) 2014-09-09 18:57:12 UTC
PS: In case it is very easy to do, and won't take much time, does anyone know how to kick koji so it spits out new versions that I can use/test for F20?

I think that's here...

http://koji.fedoraproject.org/koji/packageinfo?packageID=8391

Cheers

Comment 4 Richard W.M. Jones 2014-09-09 19:22:07 UTC
So first of all 1.27.42 isn't actually released even upstream yet.

However assuming you build a 1.27.42 tarball yourself from upstream git,
you can take the Fedora Rawhide spec file[1], changes the 'sources' and
the Source URL, and it is likely to build fine on Fedora 20.

[1] http://pkgs.fedoraproject.org/cgit/libguestfs.git/tree/
    or use: fedpkg clone -B libguestfs

Note you *will* need to use the Rawhide or f21 spec, earlier versions
certainly will not work.

Comment 5 James (purpleidea) 2014-09-17 01:41:02 UTC
For whatever reasons (presumably my poor RPM/mock/koji/COPR skills) I was unable to build this either with rpmbuild, koji, copr, or anything else :P I guess I stink at compiling this stuff.

I suppose I will have to wait for a real release, but if there is a way to make building this for the common person easier, that would be great too :)

Cheers!
James

Comment 6 Richard W.M. Jones 2014-09-17 10:02:43 UTC
It looks as if a bunch of key dependencies have changed, such as
OpenJDK.  Why not just cherry pick the upstream patch on top of
your Fedora 20 package?


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