Publish Windows VM doesn't work - qemu-img IO error

,

Hi,

I have Ubuntu LXD 4.4 stable and created a LXC VM with Windows Server 2019, like described in Running virtual machines with LXD 4.0

The VM is running just fine but if I try to publish the VM I always get IO error message from qemu-img convert:

user@lxd:~$ lxc publish win2k19-new --alias win2k19-new
Error: Failed converting image to qcow2: Failed to run: qemu-img convert -c -O qcow2 /var/snap/lxd/common/lxd/storage-pools/pool2/virtual-machines/win2k19-new/root.img /var/snap/lxd/common/lxd/images/lxd_export_373165696/rootfs.img: qemu-img: error while reading at byte 705429504: Input/output error

Also I can’t lxc copy the image or directly copy, rsync or tar.gz the rootfs.img - it always fails with IO error.
I already tried with different storage pools on different HDD/SSD disks. The pool is using btrfs, but also I got the same error with zfs.

Also I run btrfsck on the on the pools, but it reported no errors.
Currently I don’t know what to do anymore and hope someone can help me out here.

user@lxd:~$ lxc storage list 
+---------+-------------+--------+---------------------------------------------------+---------+
|  NAME   | DESCRIPTION | DRIVER |                      SOURCE                       | USED BY |
+---------+-------------+--------+---------------------------------------------------+---------+
| default |             | btrfs  | /var/snap/lxd/common/lxd/disks/default.img        | 2       |
+---------+-------------+--------+---------------------------------------------------+---------+
| pool2   |             | btrfs  | /media/user/8f0cfae9-0ea7-4cc3-bc44-457dcb07d457/ | 1       |
+---------+-------------+--------+---------------------------------------------------+---------+
user@lxd:~$ lxc config show win2k19-new --expanded
architecture: x86_64
config:
  boot.autostart: "false"
  limits.cpu: "2"
  limits.memory: 4GB
  security.secureboot: "false"
  volatile.eth0.hwaddr: 00:16:3e:4e:0a:4f
  volatile.last_state.power: STOPPED
  volatile.vm.uuid: 4c81c67a-e210-4fc7-913f-8cb4f84e6fa6
devices:
  eth0:
    name: eth0
    network: lxdbr0
    type: nic
  root:
    path: /
    pool: pool2
    size: 256GB
    type: disk
ephemeral: false
profiles:
- default
stateful: false
description: ""
user@lxd:~$ lxc profile show default
config:
  boot.autostart: "false"
description: Default LXD profile
devices:
  eth0:
    name: eth0
    network: lxdbr0
    type: nic
  root:
    path: /
    pool: default
    type: disk
name: default
used_by:
- /1.0/instances/win2k19
- /1.0/instances/win2k19-new

Please let me know if you need more information about the system.

I wonder if it is a disk space issue. How much space do you have on the partition that holds /var/snap/lxd/common/lxd/images/?

This could be the case, because I installed the OS on a 64GB USB-Stick (for testing LXD VM feature basically).

I created a 700GB btrfs loop device for default storage pool with LXD init and then created Windows VM with 256GB root disk. Because of the sparse files, with everything installed I still have 35GB free space on the stick and everything is just working fine.

But then I used a new btrfs pool on a dedicated 640GB disk, but using this pool also gives the same IO error.

Also during running lxc publish I never saw that the free space on the USB-Stick gets eaten up by maybe a tmp file. So the qeuestion is now - how much disk space on OS level would I need for my setup if this is an disk space issue?

Try creating a custom volume on one of your pools that has space and then setting storage.backups_volume so that it is used for temporary publish file.

See https://linuxcontainers.org/lxd/docs/master/server

This way it won’t export the VM to your main partition.

Thank you for helping out. I tried, but it doesn’t work either.

lxc storage volume create pool2 backup-volume size=512GB
lxc config set storage.backups_volume pool2/backup-volume
lxc config show
config:
  core.https_address: '[::]:8443'
  storage.backups_volume: pool2/backup-volume

lxc publish win2k19-new --alias win2k19-new

Error: Failed converting image to qcow2: Failed to run: qemu-img convert -c -O qcow2 /var/snap/lxd/common/lxd/storage-pools/pool2/virtual-machines/win2k19-new/root.img /var/snap/lxd/common/lxd/images/lxd_export_097046517/rootfs.img: qemu-img: error while reading at byte 705429504: Input/output error

Now I reinstalled Ubuntu on a 1TB disc and created the Windows VM again in LXD and publishing has worked now.

Excellent, so perhaps it was a fault disk block.

1 Like