Restoring LXD Config on New Host

Good afternoon LXD Gang. I’m having some issues rebuilding my LXD server and I’m wondering if the community could help me out. I attempted a upgrade from Ubuntu 18.04 → 22.04 and the upgrade failed and left the system unbootable. I messed with it a little and decided to cut my losses and start fresh.

I setup the new host exactly how it was before. And I’m ready to restore my containers. The containers are on a seperate ZFS Storage Pool. I was able to get everything to import correctly. I found a post trying to do something similar and @stgraber gave a procedure to copy and paste the config folder from old host to new host. I followed the steps but no luck.

  • I installed the LXD Snap on the new host (the old host also used the snap).
  • shutdown LXD (systemctl stop snap.lxd.daemon)
  • Rename the fresh /var/snap/lxd folder as a backup
  • Paste the lxd folder from the old host in it’s place.

However I’m unable to get LXD service to start. After rebooting the systemd ‘snap.lxd.activate’ service won’t start. Here’s the log:

Jul 30 14:38:39 cntprd01 systemd[1]: Starting Service for snap application lxd.activate...
Jul 30 14:38:39 cntprd01 systemd[3527]: snap.lxd.activate.service: Changing to the requested working directory f>
Jul 30 14:38:39 cntprd01 systemd[3527]: snap.lxd.activate.service: Failed at step CHDIR spawning /usr/bin/snap: >
Jul 30 14:38:39 cntprd01 systemd[1]: snap.lxd.activate.service: Main process exited, code=exited, status=200/CHD>
Jul 30 14:38:39 cntprd01 systemd[1]: snap.lxd.activate.service: Failed with result 'exit-code'.
Jul 30 14:38:39 cntprd01 systemd[1]: Failed to start Service for snap application lxd.activate.

If I revert back to the fresh lxd folder that comes with the snap, then the service starts fine.

Any ideas how I can get this fixed. I’ve been using LXD for years and I’m pretty good with ZFS but I’m a Snap n00b.

For some context. Here’s the folder tree for the old LXD host.

/var/snap/lxd-orig/
├── 22911
│   └── lxd
│       └── lxd.db.pre-migration
├── 22923
│   └── lxd
│       └── lxd.db.pre-migration
├── common
│   ├── config
│   ├── global-conf
│   ├── lxc
│   │   └── local.conf
│   ├── lxcfs.pid
│   ├── lxd
│   │   ├── backups
│   │   │   ├── custom
│   │   │   └── instances
│   │   ├── cache
│   │   │   ├── 64bfbd0d406818492958140cedfac3be5f9cce7fd130ca14fa2cd586a2b6842e
│   │   │   │   ├── images.json
│   │   │   │   └── index.json
│   │   │   ├── c75a7cef2922039c9f4206be4b0181b39f899bd6d33524ede301f4356c724cd8
│   │   │   │   ├── com.ubuntu.cloud:released:download.json
│   │   │   │   └── index.json
│   │   │   ├── instance_types.yaml
│   │   │   └── simplestreams.yaml
│   │   ├── containers
│   │   │   ├── gitprd01-cntprd01 -> /var/snap/lxd/common/lxd/storage-pools/lxd/containers/gitprd01-cntprd01
│   │   │   ├── habprd01-cntprd01 -> /var/snap/lxd/common/lxd/storage-pools/lxd/containers/habprd01-cntprd01
│   │   │   ├── hassprd01-cntprd01 -> /var/snap/lxd/common/lxd/storage-pools/lxd/containers/hassprd01-cntprd01
│   │   │   ├── juju-e86137-0 -> /var/snap/lxd/common/lxd/storage-pools/lxd/containers/juju-e86137-0
│   │   │   ├── lxc-monitord.log
│   │   │   ├── nxtprd01-cntprd01 -> /var/snap/lxd/common/lxd/storage-pools/lxd/containers/nxtprd01-cntprd01
│   │   │   ├── nxtprd02-cntprd01 -> /var/snap/lxd/common/lxd/storage-pools/lxd/containers/nxtprd02-cntprd01
│   │   │   ├── plxprd01-cntprd01 -> /var/snap/lxd/common/lxd/storage-pools/lxd/containers/plxprd01-cntprd01
│   │   │   ├── ubntprd01-cntprd01 -> /var/snap/lxd/common/lxd/storage-pools/lxd/containers/ubntprd01-cntprd01
│   │   │   ├── vpnprd02-cntprd01 -> /var/snap/lxd/common/lxd/storage-pools/lxd/containers/vpnprd02-cntprd01
│   │   │   ├── webprd01-cntprd01 -> /var/snap/lxd/common/lxd/storage-pools/lxd/containers/webprd01-cntprd01
│   │   │   └── webprd02-cntprd01 -> /var/snap/lxd/common/lxd/storage-pools/lxd/containers/webprd02-cntprd01
│   │   ├── database
│   │   │   ├── global
│   │   │   │   ├── 0000000001138481-0000000001139293
│   │   │   │   ├── 0000000001139294-0000000001140106
│   │   │   │   ├── 0000000001140107-0000000001140919
│   │   │   │   ├── 0000000001140920-0000000001141385
│   │   │   │   ├── 0000000001141386-0000000001141566
│   │   │   │   ├── 0000000001141567-0000000001142379
│   │   │   │   ├── 0000000001142380-0000000001142520
│   │   │   │   ├── 0000000001142521-0000000001142590
│   │   │   │   ├── 0000000001142591-0000000001142776
│   │   │   │   ├── 0000000001142777-0000000001142938
│   │   │   │   ├── 0000000001142939-0000000001143034
│   │   │   │   ├── 0000000001143035-0000000001143166
│   │   │   │   ├── 0000000001143167-0000000001143519
│   │   │   │   ├── 0000000001143520-0000000001143614
│   │   │   │   ├── 0000000001143615-0000000001143788
│   │   │   │   ├── 0000000001143789-0000000001144602
│   │   │   │   ├── 0000000001144603-0000000001144638
│   │   │   │   ├── 0000000001144639-0000000001144983
│   │   │   │   ├── 0000000001144984-0000000001145662
│   │   │   │   ├── 0000000001145663-0000000001145842
│   │   │   │   ├── 0000000001145843-0000000001145942
│   │   │   │   ├── 0000000001145943-0000000001146343
│   │   │   │   ├── 0000000001146344-0000000001146493
│   │   │   │   ├── 0000000001146494-0000000001146631
│   │   │   │   ├── 0000000001146632-0000000001146686
│   │   │   │   ├── db.bin
│   │   │   │   ├── db.bin-shm
│   │   │   │   ├── db.bin-wal
│   │   │   │   ├── metadata1
│   │   │   │   ├── metadata2
│   │   │   │   ├── open-2
│   │   │   │   ├── open-3
│   │   │   │   ├── open-4
│   │   │   │   ├── snapshot-30-1145662-3445630358
│   │   │   │   ├── snapshot-30-1145662-3445630358.meta
│   │   │   │   ├── snapshot-30-1146686-235580518
│   │   │   │   └── snapshot-30-1146686-235580518.meta
│   │   │   ├── global.bak
│   │   │   │   ├── 0000000001131906-0000000001132718
│   │   │   │   ├── 0000000001132719-0000000001133014
│   │   │   │   ├── 0000000001133015-0000000001133312
│   │   │   │   ├── 0000000001133313-0000000001134126
│   │   │   │   ├── 0000000001134127-0000000001134933
│   │   │   │   ├── 0000000001134934-0000000001134955
│   │   │   │   ├── 0000000001134956-0000000001135618
│   │   │   │   ├── 0000000001135619-0000000001136425
│   │   │   │   ├── 0000000001136426-0000000001136769
│   │   │   │   ├── 0000000001136770-0000000001137003
│   │   │   │   ├── 0000000001137004-0000000001137300
│   │   │   │   ├── 0000000001137301-0000000001137666
│   │   │   │   ├── 0000000001137667-0000000001138480
│   │   │   │   ├── 0000000001138481-0000000001139293
│   │   │   │   ├── 0000000001139294-0000000001140106
│   │   │   │   ├── 0000000001140107-0000000001140919
│   │   │   │   ├── 0000000001140920-0000000001141385
│   │   │   │   ├── db.bin
│   │   │   │   ├── db.bin-shm
│   │   │   │   ├── db.bin-wal
│   │   │   │   ├── metadata1
│   │   │   │   ├── metadata2
│   │   │   │   ├── snapshot-30-1139518-3691313582
│   │   │   │   ├── snapshot-30-1139518-3691313582.meta
│   │   │   │   ├── snapshot-30-1140542-4537321070
│   │   │   │   └── snapshot-30-1140542-4537321070.meta
│   │   │   ├── local.db
│   │   │   └── local.db.bak
│   │   ├── devices
│   │   │   ├── gitprd01-cntprd01
│   │   │   ├── habprd01-cntprd01
│   │   │   ├── hassprd01-cntprd01
│   │   │   ├── juju-e86137-0
│   │   │   ├── nxtprd01-cntprd01
│   │   │   ├── nxtprd02-cntprd01
│   │   │   ├── plxprd01-cntprd01
│   │   │   ├── ubntprd01-cntprd01
│   │   │   ├── vpnprd02-cntprd01
│   │   │   ├── webprd01-cntprd01
│   │   │   └── webprd02-cntprd01
│   │   ├── devlxd
│   │   ├── disks
│   │   │   ├── juju-btrfs.img
│   │   │   └── juju-zfs.img
│   │   ├── images
│   │   ├── logs
│   │   │   ├── bionic-template
│   │   │   │   ├── lxc.conf
│   │   │   │   └── lxc.log
│   │   │   ├── gitprd01-cntprd01
│   │   │   │   ├── lxc.conf
│   │   │   │   └── lxc.log
│   │   │   ├── habprd01-cntprd01
│   │   │   │   ├── lxc.conf
│   │   │   │   └── lxc.log
│   │   │   ├── hassprd01-cntprd01
│   │   │   │   ├── lxc.conf
│   │   │   │   └── lxc.log
│   │   │   ├── juju-e86137-0
│   │   │   │   ├── lxc.conf
│   │   │   │   └── lxc.log
│   │   │   ├── lxd.log
│   │   │   ├── lxd.log.1
│   │   │   ├── lxd.log.2.gz
│   │   │   ├── lxd.log.3.gz
│   │   │   ├── lxd.log.4.gz
│   │   │   ├── lxd.log.5.gz
│   │   │   ├── lxd.log.6.gz
│   │   │   ├── lxd.log.7.gz
│   │   │   ├── ninjaprd02-cntprd01
│   │   │   │   ├── lxc.conf
│   │   │   │   └── lxc.log
│   │   │   ├── nxtprd01-cntprd01
│   │   │   │   ├── lxc.conf
│   │   │   │   └── lxc.log
│   │   │   ├── nxtprd02-cntprd01
│   │   │   │   ├── lxc.conf
│   │   │   │   └── lxc.log
│   │   │   ├── officeprd01-cntprd01
│   │   │   │   ├── lxc.conf
│   │   │   │   └── lxc.log
│   │   │   ├── plxprd01-cntprd01
│   │   │   │   ├── lxc.conf
│   │   │   │   └── lxc.log
│   │   │   ├── ubntprd01-cntprd01
│   │   │   │   ├── lxc.conf
│   │   │   │   └── lxc.log
│   │   │   ├── vpnprd02-cntprd01
│   │   │   │   ├── lxc.conf
│   │   │   │   └── lxc.log
│   │   │   ├── webprd01-cntprd01
│   │   │   │   ├── lxc.conf
│   │   │   │   └── lxc.log
│   │   │   └── webprd02-cntprd01
│   │   │       ├── lxc.conf
│   │   │       └── lxc.log
│   │   ├── lxd.db.bak
│   │   ├── networks
│   │   ├── seccomp.socket
│   │   ├── security
│   │   │   ├── apparmor
│   │   │   │   ├── cache
│   │   │   │   │   ├── ea9ed67a.0
│   │   │   │   │   │   ├── lxd-gitprd01-cntprd01
│   │   │   │   │   │   ├── lxd-habprd01-cntprd01
│   │   │   │   │   │   ├── lxd-hassprd01-cntprd01
│   │   │   │   │   │   ├── lxd-juju-e86137-0
│   │   │   │   │   │   ├── lxd-nxtprd01-cntprd01
│   │   │   │   │   │   ├── lxd-nxtprd02-cntprd01
│   │   │   │   │   │   ├── lxd-plxprd01-cntprd01
│   │   │   │   │   │   ├── lxd-ubntprd01-cntprd01
│   │   │   │   │   │   ├── lxd-vpnprd02-cntprd01
│   │   │   │   │   │   ├── lxd-webprd01-cntprd01
│   │   │   │   │   │   └── lxd-webprd02-cntprd01
│   │   │   │   │   ├── lxd-gitprd01-cntprd01
│   │   │   │   │   ├── lxd-hassprd01-cntprd01
│   │   │   │   │   ├── lxd-juju-e86137-0
│   │   │   │   │   ├── lxd-ninjaprd02-cntprd01
│   │   │   │   │   ├── lxd-nxtprd01-cntprd01
│   │   │   │   │   ├── lxd-nxtprd02-cntprd01
│   │   │   │   │   ├── lxd-officeprd01-cntprd01
│   │   │   │   │   ├── lxd-plxprd01-cntprd01
│   │   │   │   │   ├── lxd-ubntprd01-cntprd01
│   │   │   │   │   ├── lxd-vpnprd02-cntprd01
│   │   │   │   │   └── lxd-webprd01-cntprd01
│   │   │   │   └── profiles
│   │   │   │       ├── lxd-gitprd01-cntprd01
│   │   │   │       ├── lxd-habprd01-cntprd01
│   │   │   │       ├── lxd-hassprd01-cntprd01
│   │   │   │       ├── lxd-juju-e86137-0
│   │   │   │       ├── lxd-nxtprd01-cntprd01
│   │   │   │       ├── lxd-nxtprd02-cntprd01
│   │   │   │       ├── lxd-plxprd01-cntprd01
│   │   │   │       ├── lxd-ubntprd01-cntprd01
│   │   │   │       ├── lxd-vpnprd02-cntprd01
│   │   │   │       ├── lxd-webprd01-cntprd01
│   │   │   │       └── lxd-webprd02-cntprd01
│   │   │   └── seccomp
│   │   │       ├── gitprd01-cntprd01
│   │   │       ├── habprd01-cntprd01
│   │   │       ├── hassprd01-cntprd01
│   │   │       ├── juju-e86137-0
│   │   │       ├── nxtprd01-cntprd01
│   │   │       ├── nxtprd02-cntprd01
│   │   │       ├── plxprd01-cntprd01
│   │   │       ├── ubntprd01-cntprd01
│   │   │       ├── vpnprd02-cntprd01
│   │   │       ├── webprd01-cntprd01
│   │   │       └── webprd02-cntprd01
│   │   ├── server.crt
│   │   ├── server.key
│   │   ├── shmounts -> /var/snap/lxd/common/shmounts/instances
│   │   ├── snapshots
│   │   │   ├── gitprd01-cntprd01 -> /var/snap/lxd/common/lxd/storage-pools/lxd/containers-snapshots/gitprd01-cntprd01
│   │   │   ├── hassprd01-cntprd01 -> /var/snap/lxd/common/lxd/storage-pools/lxd/containers-snapshots/hassprd01-cntprd01
│   │   │   ├── nxtprd01-cntprd01 -> /var/snap/lxd/common/lxd/storage-pools/lxd/containers-snapshots/nxtprd01-cntprd01
│   │   │   ├── nxtprd02-cntprd01 -> /var/snap/lxd/common/lxd/storage-pools/lxd/containers-snapshots/nxtprd02-cntprd01
│   │   │   ├── plxprd01-cntprd01 -> /var/snap/lxd/common/lxd/storage-pools/lxd/containers-snapshots/plxprd01-cntprd01
│   │   │   ├── ubntprd01-cntprd01 -> /var/snap/lxd/common/lxd/storage-pools/lxd/containers-snapshots/ubntprd01-cntprd01
│   │   │   ├── vpnprd02-cntprd01 -> /var/snap/lxd/common/lxd/storage-pools/lxd/containers-snapshots/vpnprd02-cntprd01
│   │   │   └── webprd01-cntprd01 -> /var/snap/lxd/common/lxd/storage-pools/lxd/containers-snapshots/webprd01-cntprd01
│   │   ├── storage-pools
│   │   │   ├── containers
│   │   │   │   └── plxprd01-cntprd01
│   │   │   ├── juju-btrfs
│   │   │   ├── juju-zfs
│   │   │   │   ├── containers
│   │   │   │   ├── containers-snapshots
│   │   │   │   ├── custom
│   │   │   │   ├── custom-snapshots
│   │   │   │   ├── images
│   │   │   │   ├── virtual-machines
│   │   │   │   └── virtual-machines-snapshots
│   │   │   └── lxd
│   │   │       ├── containers
│   │   │       │   ├── gitprd01-cntprd01
│   │   │       │   ├── habprd01-cntprd01
│   │   │       │   ├── hassprd01-cntprd01
│   │   │       │   ├── juju-e86137-0
│   │   │       │   ├── nxtprd01-cntprd01
│   │   │       │   ├── nxtprd02-cntprd01
│   │   │       │   ├── plxprd01-cntprd01
│   │   │       │   ├── ubntprd01-cntprd01
│   │   │       │   ├── vpnprd02-cntprd01
│   │   │       │   ├── webprd01-cntprd01
│   │   │       │   └── webprd02-cntprd01
│   │   │       ├── containers-snapshots
│   │   │       │   ├── gitprd01-cntprd01
│   │   │       │   │   ├── quarterly-20190102
│   │   │       │   │   ├── quarterly-20190104
│   │   │       │   │   ├── quarterly-20190427
│   │   │       │   │   ├── quarterly-20191021
│   │   │       │   │   └── quarterly-20200314
│   │   │       │   ├── hassprd01-cntprd01
│   │   │       │   │   ├── quarterly-20190427
│   │   │       │   │   ├── quarterly-20191021
│   │   │       │   │   └── quarterly-20200314
│   │   │       │   ├── nxtprd01-cntprd01
│   │   │       │   │   ├── quarterly-20190102
│   │   │       │   │   ├── quarterly-20190427
│   │   │       │   │   ├── quarterly-20191021
│   │   │       │   │   ├── quarterly-20200314
│   │   │       │   │   └── snap0
│   │   │       │   ├── nxtprd02-cntprd01
│   │   │       │   │   ├── fresh_nextcloud
│   │   │       │   │   ├── pre-migrate-20200321
│   │   │       │   │   ├── quarterly-20200314
│   │   │       │   │   ├── snap0
│   │   │       │   │   ├── snap1
│   │   │       │   │   ├── snap2
│   │   │       │   │   └── snap3
│   │   │       │   ├── plxprd01-cntprd01
│   │   │       │   │   ├── quarterly-20190102
│   │   │       │   │   ├── quarterly-20190427
│   │   │       │   │   ├── quarterly-20191021
│   │   │       │   │   └── quarterly-20200314
│   │   │       │   ├── ubntprd01-cntprd01
│   │   │       │   │   ├── quarterly-20190427
│   │   │       │   │   ├── quarterly-20191021
│   │   │       │   │   ├── quarterly-20200314
│   │   │       │   │   ├── snap0
│   │   │       │   │   ├── snap1
│   │   │       │   │   ├── snap10
│   │   │       │   │   ├── snap11
│   │   │       │   │   ├── snap12
│   │   │       │   │   ├── snap13
│   │   │       │   │   ├── snap14
│   │   │       │   │   ├── snap15
│   │   │       │   │   ├── snap2
│   │   │       │   │   ├── snap3
│   │   │       │   │   ├── snap4
│   │   │       │   │   ├── snap5
│   │   │       │   │   ├── snap6
│   │   │       │   │   ├── snap7
│   │   │       │   │   ├── snap8
│   │   │       │   │   └── snap9
│   │   │       │   ├── vpnprd02-cntprd01
│   │   │       │   │   ├── quarterly-20190102
│   │   │       │   │   ├── quarterly-20190427
│   │   │       │   │   ├── quarterly-20191021
│   │   │       │   │   └── quarterly-20200314
│   │   │       │   └── webprd01-cntprd01
│   │   │       │       ├── quarterly-20190102
│   │   │       │       ├── quarterly-20190427
│   │   │       │       ├── quarterly-20191021
│   │   │       │       └── quarterly-20200314
│   │   │       ├── custom
│   │   │       ├── custom-snapshots
│   │   │       ├── images
│   │   │       ├── virtual-machines
│   │   │       └── virtual-machines-snapshots
│   │   ├── unix.socket
│   │   ├── virtual-machines
│   │   └── virtual-machines-snapshots
│   ├── lxd.pid
│   ├── lxd-user
│   │   └── unix.socket
│   ├── mntns -> /proc/1872/root
│   ├── ns
│   ├── shmounts
│   ├── state
│   └── var
│       └── lib
│           └── lxcfs -> /var/snap/lxd/common/shmounts/lxcfs
└── current -> 22923

And here’s the ZFS storage pool:

NAME                                                                                          USED  AVAIL     REFER  MOUNTPOINT
hddpool/lxd                                                                                   561G   973G      140K  none
hddpool/lxd/containers                                                                        559G   973G      140K  none
hddpool/lxd/containers/gitprd01-cntprd01                                                     16.1G   973G     8.93G  legacy
hddpool/lxd/containers/habprd01-cntprd01                                                     1.17G   973G     1.60G  legacy
hddpool/lxd/containers/hassprd01-cntprd01                                                    14.5G   973G     10.9G  /var/snap/lxd/common/lxd/storage-pools/lxd/containers/hassprd01-cntprd01
hddpool/lxd/containers/juju-e86137-0                                                         3.57G   973G     3.73G  legacy
hddpool/lxd/containers/nxtprd01-cntprd01                                                     91.0G   973G     85.8G  none
hddpool/lxd/containers/nxtprd02-cntprd01                                                     97.8G   973G     94.9G  legacy
hddpool/lxd/containers/plxprd01-cntprd01                                                      320G   973G      314G  legacy
hddpool/lxd/containers/ubntprd01-cntprd01                                                    9.95G   973G     1.43G  legacy
hddpool/lxd/containers/vpnprd02-cntprd01                                                      848M   973G      453M  legacy
hddpool/lxd/containers/webprd01-cntprd01                                                     3.49G   973G     1.89G  legacy
hddpool/lxd/containers/webprd02-cntprd01                                                      288M   973G      553M  legacy
hddpool/lxd/custom                                                                            140K   973G      140K  none
hddpool/lxd/deleted                                                                          2.07G   973G      140K  none
hddpool/lxd/deleted/containers                                                               75.7M   973G      140K  none
hddpool/lxd/deleted/containers/84b6d698-e2a5-42c2-a8eb-a0efe2007ae3                          75.5M   973G      328M  /var/snap/lxd/common/lxd/storage-pools/lxd/containers/bionic-template
hddpool/lxd/deleted/custom                                                                    140K   973G      140K  none
hddpool/lxd/deleted/images                                                                   1.99G   973G      140K  none
hddpool/lxd/deleted/images/3de1142834d38bda12a7323da2807d7a44b50fb135820b5d7733df324a411f5d   261M   973G      261M  none
hddpool/lxd/deleted/images/5fc94479f588171282beb094da96bb83eb51420d6cf13b223c737d1fda9169cd   727M   973G      727M  none
hddpool/lxd/deleted/images/8f9da4cd832ba0235749caa2249c1ecfcee0cee052c4647fb502955fcec70072   482M   973G      482M  /var/snap/lxd/common/lxd/storage-pools/lxd/images/8f9da4cd832ba0235749caa2249c1ecfcee0cee052c4647fb502955fcec70072
hddpool/lxd/deleted/images/e3ba2f6447f4e5d46cd58b13003b58612a2d547005f3971dfd439960361f949d   310M   973G      310M  none
hddpool/lxd/deleted/images/e9b96e469242c7a3cd5c05faa0a0d930fc84a3671c8d7218ba0cc7b99f714e64   262M   973G      262M  none
hddpool/lxd/deleted/virtual-machines                                                          140K   973G      140K  none
hddpool/lxd/images                                                                            436M   973G      140K  none
hddpool/lxd/images/353b1a2c367ec983fd9d1532171618cd967e96d77a06f6b6e024c39ec010e8d7           436M   973G      436M  /var/snap/lxd/common/lxd/storage-pools/lxd/images/353b1a2c367ec983fd9d1532171618cd967e96d77a06f6b6e024c39ec010e8d7
hddpool/lxd/snapshots                                                                        1.50M   973G      140K  none
hddpool/lxd/snapshots/dashprd01-cntprd01                                                      140K   973G      140K  none
hddpool/lxd/snapshots/gitprd01-cntprd01                                                       140K   973G      140K  none
hddpool/lxd/snapshots/hassprd01-cntprd01                                                      140K   973G      140K  none
hddpool/lxd/snapshots/ninjaprd02-cntprd01                                                     140K   973G      140K  none
hddpool/lxd/snapshots/nxtprd01-cntprd01                                                       140K   973G      140K  none
hddpool/lxd/snapshots/officeprd01-cntprd01                                                    140K   973G      140K  none
hddpool/lxd/snapshots/plxprd01-cntprd01                                                       140K   973G      140K  none
hddpool/lxd/snapshots/ubntprd01-cntprd01                                                      140K   973G      140K  none
hddpool/lxd/snapshots/vpnprd02-cntprd01                                                       140K   973G      140K  none
hddpool/lxd/snapshots/webprd01-cntprd01                                                       140K   973G      140K  none
hddpool/lxd/virtual-machines                                                                  140K   973G      140K  none

The supported way to restore an existing storage pool after the database has been corrupted/removed (due to a reinstall in this case) is to use lxd recover.

See Backing up a LXD server - LXD documentation

Hello tomp. Appreciate your time taking a look. I wasn’t aware of LXD Recover. Cool stuff. So what I did is replace the lxd config folder with my backup that comes with the snap. So basically a blank slate. I rebooted just to make sure and confirmed that LXD service was working. a ‘lxc list’ shows a empty server.

I played around with ‘lxd recover’ but was a little confused how the command works. I looked up some discussions with examples and I believe I’m doing it right. But it’s not seeing any storage pool.

I’ve tried a bunch of different combos of “Name of storage pool” and “source of the storage pool”. So I’m not sure if it’s the server or if I’m just being dumb.

Any ideas?

This LXD server currently has the following storage pools:
Would you like to recover another storage pool? (yes/no) [default=no]: yes
Name of the storage pool: lxd
Name of the storage backend (ceph, btrfs, cephfs, dir, lvm, zfs): zfs
Source of the storage pool (block device, volume group, dataset, path, ... as applicable): hddpool/lxd
Additional storage pool configuration property (KEY=VALUE, empty when done):
Would you like to recover another storage pool? (yes/no) [default=no]: no
The recovery process will be scanning the following storage pools:
 - NEW: "lxd" (backend="zfs", source="hddpool/lxd")
Would you like to continue with scanning for lost volumes? (yes/no) [default=yes]:
Scanning for unknown volumes...
Error: Failed validation request: Failed mounting pool "lxd": Cannot mount pool as "zfs.pool_name" is not specified

While playing around. Replacing the lxd config folder with the original from the old server. I can actually get the server to start with ‘lxd --debug --group lxd’. The containers do not start with the error:

Daemon failed to setup shared mounts base. Does security.nesting need to be turned on?

But the server does start. I can run lxc list and the containers show up. To debug my previous reply to @tomp, I looked up the storage pool and got the following.

+------------+--------+-----------------------------------------------+-------------+---------+---------+
|    NAME    | DRIVER |                    SOURCE                     | DESCRIPTION | USED BY |  STATE  |
+------------+--------+-----------------------------------------------+-------------+---------+---------+
| juju-btrfs | btrfs  | /var/snap/lxd/common/lxd/disks/juju-btrfs.img |             | 0       | CREATED |
+------------+--------+-----------------------------------------------+-------------+---------+---------+
| juju-zfs   | zfs    | /var/snap/lxd/common/lxd/disks/juju-zfs.img   |             | 0       | CREATED |
+------------+--------+-----------------------------------------------+-------------+---------+---------+
| lxd        | zfs    | hddpool/lxd                                   |             | 43      | CREATED |
+------------+--------+-----------------------------------------------+-------------+---------+---------+

So I don’t know why ‘lxd recover’ can’t pick up that storage pool.

Hrm, the lxd recover command is expected to run on a fresh installation of LXD with no existing database.

If you have manually recovered the database, then lxd recover won’t have anything to do (its only job is to recover the database), and if you can see the containers from the old storage pool then its job is done.

To answer your earlier question, you should do:

Additional storage pool configuration property (KEY=VALUE, empty when done): zfs.pool_name=<old ZFS pool name>
1 Like