Widnows VM creation from image - Error increasing volume size

I have recently been creating Windows Server 2019 VMs from an image. However, due to testing purposes I had to delete the Windows VM image from LXD and import it again, after which I have not been able to iniate a VM with the same image:

$ lxc init wserver19 windows-test --vm -c security.secureboot=false -c limits.cpu=4 -c limits.memory=4GB -p bridge -s lxd-pool
Creating windows-test
Error: Create instance from image: Error increasing volume size: Not supported

Image info:

Fingerprint: cee305252934f842b4d9422ba378221bde8e893d35e1a62c40269823ec9b963c
Size: 5357.71MB
Architecture: x86_64
Type: virtual-machine
Public: no
Timestamps:
    Created: 2020/11/10 12:04 UTC
    Uploaded: 2020/11/24 18:52 UTC
    Expires: never
    Last used: 2020/11/24 18:52 UTC
Properties:
Aliases:
    - wserver19
Cached: no
Auto update: disabled
Profiles:
    - default

Storage pool info:

config:
  size: 40GB
  source: /var/snap/lxd/common/lxd/disks/lxd-pool.img
  zfs.pool_name: lxd-pool
description: ""
name: lxd-pool
driver: zfs
used_by:
- /1.0/images/00ded6a31d06ddb5b5a5c2bac2e1fea9f004a7c43cb29bc161c80dbb2c50f108
- /1.0/profiles/default
status: Created
locations:
- none

Profile info:

config: {}
description: Profile to be used when creating container instances through the UI.
devices:
  eth0:
    name: eth0
    nictype: bridged
    parent: br0
    type: nic
  root:
    path: /
    pool: lxd-pool
    type: disk
name: bridge
used_by: []

Any help is greatly appreciated.

What version of lxd are you running?

Also can you enable debug logging and give output from that as you try to launch the VM please.

sudo snap set lxd daemon.debug=true; sudo systemctl reload snap.lxd.daemon
sudo tail -f /var/snap/lxd/common/lxd/logs/lxd.log

Ah I know what this is, its an issue related to the new reference counting for mounts, and for ZFS the protection we added to prevent resizing image volumes, but in the case of unpacking images into initial image volumes we need to allow unrestricted resizing of volumes by the unpacker. I’ll add a fix.

Ok, thank you. I’ll be looking forward for updates. I’m using LXD 4.7 if that helps.

This should fix the issue:

How can I apply this fix locally? I’m currently tracking 4.7/stable through snap.

You can run the edge snap, although please note that due to a schema change between edge and LXD 4.8 you won’t be able to downgrade until the next release, so be sure to run this on a separate system when testing. I think @stgraber will cherry-pick this fix into the LXD 4.8 snap version soon anyway.

sudo snap refresh lxd --channel=latest/edge

Ok, I will try the fix and post any findings.

I can confirm the fix works:

$ lxc init wserver19 windows-test --vm -c security.secureboot=false -c limits.cpu=4 -c limits.memory=4GB -p bridge -s lxd-pool
$ lxc config device set windows-test root size=30GB
$ lxc start windows-test
$ lxc list
+----------------+---------+---------------------+-----------------------------------------------+-----------------+-----------+
|      NAME      |  STATE  |        IPV4         |                     IPV6                      |      TYPE       | SNAPSHOTS |
+----------------+---------+---------------------+-----------------------------------------------+-----------------+-----------+
| windows-test   | RUNNING | 192.168.1.13 (eth0) |                                               | VIRTUAL-MACHINE | 0         |
+----------------+---------+---------------------+-----------------------------------------------+-----------------+-----------+

Thank you!

1 Like