[Libguestfs] [libguestfs/libguestfs] resize with ubuntu-20.04 (#63)
Richard W.M. Jones
rjones at redhat.com
Mon Feb 8 12:38:08 UTC 2021
On Mon, Feb 08, 2021 at 04:28:24AM -0800, Peter Willis wrote:
> Is there something I am missing to resize the disk in the ubuntu-20.04
> template?
>
> # virt-builder ubuntu-20.04 --size 30G
> [ 0.8] Downloading: http://builder.libguestfs.org/ubuntu-20.04.xz
> [ 1.8] Planning how to build this image
> [ 1.8] Uncompressing
> [ 10.9] Resizing (using virt-resize) to expand the disk to 30.0G
> virt-resize: error: /dev/sda5: partition not found in the source disk image
> (this error came from ‘--expand’ option on the command line). Try
> running this command: virt-filesystems --partitions --long -a
> /var/tmp/vb7ee275.img
>
> If reporting bugs, run virt-resize with debugging enabled and include the
> complete output:
>
> virt-resize -v -x [...]
>
> Or:
>
> # virt-list-partitions -lh ubuntu-20.04.img
> /dev/sda1 vfat 512.0M
> /dev/sda2 unknown 1K
> /dev/sda5 ext4 5.5G
> # truncate -r ubuntu-20.04.img ubuntu-20.04-resized.img
> # truncate -s +5G ubuntu-20.04-resized.img
> # virt-resize --expand /dev/sda5 ubuntu-20.04.img ubuntu-20.04-resized.img
> [ 0.0] Examining ubuntu-20.04.img
> virt-resize: error: /dev/sda5: partition not found in the source disk image
> (this error came from ‘--expand’ option on the command line). Try
> running this command: virt-filesystems --partitions --long -a
> ubuntu-20.04.img
>
> If reporting bugs, run virt-resize with debugging enabled and include the
> complete output:
>
> virt-resize -v -x [...]
The problem is that this image is incompatible with virt-resize:
$ virt-builder ubuntu-20.04
$ virt-filesystems -a ubuntu-20.04.img --all -l -h
Name Type VFS Label MBR Size Parent
/dev/sda1 filesystem vfat - - 511M -
/dev/sda5 filesystem ext4 - - 5.3G -
/dev/sda1 partition - - 0b 512M /dev/sda
/dev/sda2 partition - - 05 1.0K /dev/sda
/dev/sda5 partition - - 83 5.5G /dev/sda
/dev/sda device - - - 6.0G -
Note the root filesystem is on a logical partition (/dev/sda5) which
virt-resize cannot handle:
https://libguestfs.org/virt-resize.1.html#logical-partitions
I wonder if there's a way to make Ubuntu templates that don't use
logical partitions?
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
More information about the Libguestfs
mailing list