Getting "lxd recover" to work

Checking what the mountpoint was on a different host, I did:

root@nuc2:~# zfs set mountpoint=/var/snap/lxd/common/lxd/storage-pools/default zfs/lxd

Definitely getting closer:

Scanning for unknown volumes...
Error: Failed validation request: Failed checking volumes on pool "default": Instance "proxmox2.old" in project "default" has a different instance name in its backup file ("proxmox2")

OK, I know what’s going on here. I intentionally left some previous versions of containers on my backup server (renaming then, prior to rebuilding those containers). I’ve now fixed this by deleting the local datasets - although in my opinion it would be much better if lxd recover could restore what it could, and skip over any containers which it found to be invalid.

Try again:

Scanning for unknown volumes...
Error: Failed validation request: Failed checking volumes on pool "default": Instance "etcd2" in project "default" has a different instance type in its backup file ("")

Mounting it, I can’t see what it means by “instance type” in etcd2/backup.yaml. But as this is a container I don’t need, for now it gets the zfs destroy -r treatment too. (I can always resync from my backup)

Next attempt gives a different error:

...
Scanning for unknown volumes...
Error: Failed validation request: Failed checking volumes on pool "default": Failed parsing backup file "/var/snap/lxd/common/lxd/storage-pools/default/containers/nsot/backup.yaml": open /var/snap/lxd/common/lxd/storage-pools/default/containers/nsot/backup.yaml: no such file or directory

It’s quite right, there’s no backup.yaml there:

root@nuc2:~# zfs mount zfs/lxd/containers/nsot
root@nuc2:~# ls /var/snap/lxd/common/lxd/storage-pools/default/containers/nsot/
metadata.yaml  rootfs  templates
root@nuc2:~# zfs unmount zfs/lxd/containers/nsot

Maybe this container was made with an older version of lxd and never run with a newer one. Zap again.

And finally: the remaining volumes are recovered successfully, and I can start the containers. Phew!

That was rather harder work than I was expecting. Maybe in future I’ll just restore /var/snap/lxd/common/lxd, although I was hoping not to have to do that.

Regards,

Brian.

1 Like