Unable to export/import Windows VM

How can we backup and restore windows vm in lxd?

The same way you would with a container:

lxc export <instance> <filename>
lxc import <filename>

I have tried like container and after import the vm start and it brings me recovery state.

Was the VM stopped when you exported it?

yes

Any ideas @monstermunchkin , is this something you can test to see if its reproducible?

I split off this thread into its own topic and assigned it to @monstermunchkin for investigation.

1 Like

I cannot confirm this.

Here’s what I did:

  • Install Windows 10 (repacked Win10_21H1_English_x64.iso using distrobuilder) and go through the configuration (keyboard layout, etc.) after the first reboot
  • Once logged in, shutdown the VM properly
  • Run lxc export win10
  • Run lxc import backup.tar.gz win10-restored
  • Run lxc start win10-restored --console=vga

I boots without any issues.

@hafijaa what storage backend are you using in LXD?

ZFS storage

@monstermunchkin can you test on zfs if you were using something else?

Tested it on ZFS. It works just fine.