[Libguestfs] virt-resize

Richard W.M. Jones rjones at redhat.com
Thu Jun 15 09:15:56 UTC 2017


On Thu, Jun 15, 2017 at 09:04:06AM +0000, JuanEsteban.Jimenez at mdc-berlin.de wrote:
[...]

> This is my starting point. I am using your instructions as posted
> here: http://libguestfs.org/virt-resize.1.html
>
> # virt-filesystems --long -h --all -a img-1.qcow2
> Name              Type        VFS   Label  MBR  Size  Parent
> /dev/sda1         filesystem  xfs   -      -    500M  -
> /dev/centos/root  filesystem  xfs   -      -    15G   -
> /dev/centos/swap  filesystem  swap  -      -    820M  -
> /dev/centos/root  lv          -     -      -    15G   /dev/centos
> /dev/centos/swap  lv          -     -      -    820M  /dev/centos
> /dev/centos       vg          -     -      -    16G   /dev/sda2
> /dev/sda2         pv          -     -      -    16G   -
> /dev/sda1         partition   -     -      83   500M  /dev/sda
> /dev/sda2         partition   -     -      8e   16G   /dev/sda
> /dev/sda          device      -     -      -    32G   -
>
> My goal is to end up with an image that has a 32G root
> filesystem. To do that I use the command:
>
> virt-resize --expand /dev/sda2 --LV-expand /dev/centos/root  img-1.qcow2 img-1a.qcow2
> 
> # virt-filesystems --long -h --all -a img-1a.qcow2
> Name              Type        VFS   Label  MBR  Size  Parent
> /dev/sda1         filesystem  xfs   -      -    500M  -
> /dev/centos/root  filesystem  xfs   -      -    15G   -

The fact that /dev/centos/root (XFS filesystem) wasn't resized here
indicates that you don't have the correct XFS subpackage installed.

Virt-resize would have given you a warning about this, but in any case
you need to install the ‘libguestfs-xfs’ package on the host.

> /dev/centos/swap  filesystem  swap  -      -    820M  -
> /dev/centos/root  lv          -     -      -    15G   /dev/centos
> /dev/centos/swap  lv          -     -      -    820M  /dev/centos
> /dev/centos       vg          -     -      -    32G   /dev/sda2
> /dev/sda2         pv          -     -      -    32G   -
> /dev/sda1         partition   -     -      83   500M  /dev/sda
> /dev/sda2         partition   -     -      8e   32G   /dev/sda
> /dev/sda          device      -     -      -    32G   -
>
> I then booted the VM and tries xfs_growfs on /dev/mapper/centos-root
> and it doesn’t do anything but show me the filesystem geometry.

You shouldn't need to resize anything in the guest, virt-resize
should do it - see above.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the Libguestfs mailing list