How to set VM root volume size when lxc init?

Hi all,

I created a VM image by:

lxc init images:oracle/7 oracle-19c-vm --vm -c limits.cpu=2 -c limits.memory=2GiB
lxc config device override oracle-19c-vm root size=20GiB
lxc start oracle-19c-vm
lxc stop oracle-19c-vm
lxc publish oracle-19c-vm --compression xz --alias vm/oracle-19c --public
lxc rm oracle-19c-vm

But when I tried to init a new instance:

lxc init vm/oracle-19c oracle-19c-vm-2 --vm

It ran into

Creating oracle-19c-vm-2
Error: Create instance from image: Failed converting image to raw at /dev/zvol/lxd/images/c7a031bc885bfad8ed37763f7a5283a3b472cbf5588a9a6b90034b6793a0efb1.block: Failed to run: qemu-img
convert -O raw /var/snap/lxd/common/lxd/images/lxd_image_unpack_477474043/rootfs.img /dev/zvol/lxd/images/c7a031bc885bfad8ed37763f7a5283a3b472cbf5588a9a6b90034b6793a0efb1.block: qemu-img
: /dev/zvol/lxd/images/c7a031bc885bfad8ed37763f7a5283a3b472cbf5588a9a6b90034b6793a0efb1.block: error while converting raw: Cannot grow device files

I found that /dev/zvol/lxd/images/c7a031bc885bfad8ed37763f7a5283a3b472cbf5588a9a6b90034b6793a0efb1.block is onlly 10GB but vm/oracle-19c image size is 20GiB

Why is not the new instance root volume size set to the source image size?

Is it a bug?

What version of LXD are you running. I have been working on a series of patches recently to improve the initial volume sizing in various scenarios due to the issues caused by the increased storage requirements of VMs.

I’ve changed the category of this post to LXD as this is not referencing the older lxc tools.

@tomp I installed LXD by snap:

lxc version
Client version: 4.0.1
Server version: 4.0.1

Thanks. I’ve re-created this issue locally. It seems there is need for another patchset that deals with creating optimized images volumes that are greater than the default 10GB size to cope with this scenario.

The patchset I added recently were for migrations and backup restores that are >10GB size.

Will add to the list to fix.


Given the name of pool is default, I find a workaround:

lxc storage edit default


  volume.size: 20GiB

Then it runs OK:

lxc init vm/oracle-19c oracle-19c-vm-2 --vm

volume.size indicates the default root volume size.

Yes this will create all new volumes on that pool as 20GB which works as a temporary workaround until the bug is fixed. Thanks