The steps are as follows:
Resize2fs already done with -r key above. Otherwise:
resize2fs /dev/ubuntu-vg/ubuntu-lv df -h lsblk
modprobe nbd max_part=63 qemu-nbd -c /dev/nbd0 Fedora-x86_64-20-20141008-sda-compute.qcow2 mount /dev/nbd0p2 /mnt/cf error mounting lvm2_member fdisk -l show nothing
lvmdiskscan
/dev/fedora_dai142/lv_root [ 78.12 GiB]
/dev/sda1 [ 200.00 MiB]
/dev/nbd0p1 [ 500.00 MiB]
/dev/fedora_dai142/lv_swap00 [ 9.77 GiB]
/dev/sda2 [ 500.00 MiB]
/dev/nbd0p2 [ 9.51 GiB] LVM physical volume
/dev/fedora_dai142/lv_home [ 117.19 GiB]
/dev/sda3 [ 205.08 GiB] LVM physical volume
/dev/sdb1 [ 300.00 GiB]
/dev/sdb2 [ 10.00 GiB]
/dev/sdb3 [ 246.12 GiB]
/dev/sdb4 [ 375.39 GiB] LVM physical volume
2 disks
7 partitions
0 LVM physical volume whole disks
3 LVM physical volumes
qemu-nbd -d /dev/nbd0 vgchange -an VolGroupName killall qemu-nbd
Basically: Copy old-image to new-image +resize
Create new image
qemu-img create -f qcow2 newdisk.qcow2 15G
Mount qcow2 image with guestfish
Mount the image in read-write mode as root, as follows:
# guestfish --rw -a Fedora-x86_64-20-20141008-sda-compute.qcow2
We must first use the run command at the guestfish prompt before we can do anything else. This will launch a virtual machine, which will be used to perform all of the file manipulations.
><fs> run ><fs> list-devices /dev/sda1 /dev/sda2 ><fs> list-filesystems /dev/fedora/root: ext4 <-- here it is /dev/fedora/swap: swap
We're done, so we can exit using the exit command:
><fs> exit
virt-resize --expand /dev/sda2 --LV-expand /dev/fedora/root \
olddisk newdisk
virt-resize --expand /dev/sda2 --LV-expand /dev/fedora/root \
> Fedora-x86_64-20-20141008-sda-controller.qcow2 Fedora-x86_64-20-20141008-sda-controller2.qcow2
Examining Fedora-x86_64-20-20141008-sda-controller.qcow2 ...
◓ 25% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒══════════════════════════════════════════════════════⟧ --:--
100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
**********
Summary of changes:
/dev/sda1: This partition will be left alone.
/dev/sda2: This partition will be resized from 9.5G to 39.5G. The LVM
PV on /dev/sda2 will be expanded using the 'pvresize' method.
/dev/fedora/root: This logical volume will be expanded to maximum size.
The filesystem ext4 on /dev/fedora/root will be expanded using the
'resize2fs' method.
**********
Setting up initial partition table on Fedora-x86_64-20-20141008-sda-controller2.qcow2 ...
Copying /dev/sda1 ...