I am trying to move a disk that contains a storage pool and containers from one LXD server to another.
I can’t use copy or move in my case. I need to move the physical disk.
My thought was that I do the following steps:
on the new server create a storage pool
mount the new drive on the location of the new storage pool
start the containers
Unfortunately it seems to be a bit more tricky than that. lxd list doesn’t show the containers from the new device.
I made sure that the links in /var/lib/lxd/containers and /var/lib/lxd/storage-pools are available but no success.
Then I saw in the storage-pool config that the used-by: entry is empty. But adding the containers doesn’t help either. The entry gets lost after I saved the file.
LXD uses a database to keep track of everything. Simply moving the files around won’t do it.
What LXD version are you running?
Newer LXD releases have a “lxd import” command that’s used to deal with those cases.
Make sure everything is back into place and then run “lxd import NAME” for every container you’d like to re-import from disk.