[Libguestfs] [libvirt-users] Resize errors with virt-resize/vgchange

Richard W.M. Jones rjones at redhat.com
Thu Jul 25 08:14:47 UTC 2013


On Wed, Jul 24, 2013 at 10:32:08PM -0400, Alex wrote:
> Hi,
> 
> >> Yes, here's the layout from the vm:
> >>
> >> # df -h
> >> Filesystem                Size  Used Avail Use% Mounted on
> >> devtmpfs                  7.9G     0  7.9G   0% /dev
> >> tmpfs                     7.9G     0  7.9G   0% /dev/shm
> >> tmpfs                     7.9G  643M  7.3G   9% /run
> >> tmpfs                     7.9G     0  7.9G   0% /sys/fs/cgroup
> >> /dev/mapper/prop-root      15G   11G  2.9G  79% /
> >> tmpfs                     7.9G   12K  7.9G   1% /tmp
> >> /dev/mapper/prop-boot     477M   95M  358M  21% /boot
> >> /dev/mapper/prop-home     222G  215G  7.6G  97% /home
> >>
> >> I'll add this info to the bug report.
> >
> > Just to be clear, it has multiple virtual block devices, eg.
> > /dev/vda and /dev/vdb ...?
> >
> > This isn't (currently) a supported configuration for virt-resize,
> > although it ought to be.
> 
> Yes, that's correct - vda and vdb. Not sure how I missed that previously.
> 
> Can I perform the steps that virt-resize executes manually instead,
> and either perform it only on the one to be resized or otherwise
> adjust the arguments accordingly? Is it documented?

Ignore my previous answer ...

Yes, you could do the steps manually.  However it's a massive PITA
which is why virt-resize exists in the first place.

You would have to do something like:

  guestfish
  ><fs> add-ro prop-1.img                       # sda
  ><fs> add-ro prop-2.img                       # sdb
  ><fs> sparse prop-expand.img <SIZE>           # sdc
  ><fs> run
  ><fs> part-list /dev/sda

Followed by commands to create the partitions/PVs/VGs/LVs on sdc:

  ><fs> part-init /dev/sdc mbr
  ><fs> part-add /dev/sdc p <#1...>
  ><fs> part-add /dev/sdc p <#2...>
  ><fs> pvcreate /dev/sdc2
  ><fs> vgcreate prop2 /dev/sdc2
  ><fs> lvcreate root prop2 <#3>
  ><fs> lvcreate-free home prop2 100

#1: choose same sector parameters as output of part-list above
#2: start at same place as second sector on /dev/sda, end at end of disk
#3: choose same size as original root disk

Note you have to rename the VG.  virt-resize itself does some complex
trickery to avoid this.  If you rename the VG, you will need to also
edit /etc/fstab in the guest accordingly.

Followed by commands to copy the data from the original filesystems
over, eg.:

  ><fs> copy-device-to-device /dev/prop/root /dev/prop2/root
  ><fs> resize2fs /dev/prop2/root

Then, boot the resulting disk in virt-rescue, mount all the partitions
up on /sysroot, chroot into /sysroot, and run grub from the guest to
install the bootloader.  Edit /etc/fstab if required.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
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