Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I'm not sure the following approach is suitable, but it works well.

  1. Still follow the guide to create an qcow2 image with LVM.
  2. Add firstboot script to the image when virt-sysprep.

In the script,

1) Use parted to resize extended partition to the end of whole disk.

2) Make a new logical partition for undefined disk size as /dev/sda6.

3) Set /dev/sda6 as lvm label.

4) Create a new physical volume for /dev/sda6.

5) Add this physical volume to the original volume group.

6) Extend root logical volume (/dev/mapper/ubuntu--vg-root) with /dev/sda6.

7) resize2fs /dev/mapper/ubuntu--vg-root.

Please give me any suggestions if something wrong. Thanks.