Zfs storage mounting to new LXD server

Hi,

Following this guide:https://blog.simos.info/reconnecting-your-lxd-installation-to-the-zfs-storage-pool/ to restore the zfs pool to my new vm machine. I installed LXD and attached the zfs storage, and can see the containers in the list,as you can see here:

NAME                                                                              USED  AVAIL  REFER  MOUNTPOINT
default                                                                          4.18G   476G    96K  none
default/containers                                                               2.36G   476G    96K  none
default/containers/abbymt4mt5                                                    2.29G  21.0G  3.66G  /var/snap/lxd/common/lxd/storage-pools/default/containers/abbymt4mt5
default/containers/proxy                                                         8.32M  23.3G   398M  /var/snap/lxd/common/lxd/storage-pools/default/containers/proxy
default/containers/wandalist                                                     54.1M  23.2G  1.44G  /var/snap/lxd/common/lxd/storage-pools/default/containers/wandalist
default/custom                                                                     96K   476G    96K  none
default/deleted                                                                   480K   476G    96K  none
default/deleted/containers                                                         96K   476G    96K  none
default/deleted/custom                                                             96K   476G    96K  none
default/deleted/images                                                             96K   476G    96K  none
default/deleted/virtual-machines                                                   96K   476G    96K  none
default/images                                                                   1.82G   476G    96K  none
default/images/3e26e731b8b32e092e3978410a174e76055ff3ee737c135a84ab77b3d2444167  1.43G  21.8G  1.43G  /var/snap/lxd/common/lxd/storage-pools/default/images/3e26e731b8b32e092e3978410a174e76055ff3ee737c135a84ab77b3d2444167
default/images/8c1c160181c173134224e98ab0f2823d19242f1ed885c45f3371903848da8f7e   396M  22.9G   396M  /var/snap/lxd/common/lxd/storage-pools/default/images/8c1c160181c173134224e98ab0f2823d19242f1ed885c45f3371903848da8f7e
default/virtual-machines                                                           96K   476G    96K  none

When I am running the lxd import it says :

Error: The instance's directory "/var/snap/lxd/common/lxd/storage-pools/default/containers/abbymt4mt5" appears to be empty. Please ensure that the instance's storage volume is mounted

Can anyone help me guide the steps to reattach those containers with my zfs storage/LXD installation?

nsenter --mount=/run/ns/snapd/lxd.mnt mount -t zfs containers/abbymt4mt5 /var/snap/lxd/common/lxd/storage-pools/default/containers/abbymt4mt5

That will mount it properly where LXD expects it, then the lxd import should work.

1 Like

~# nsenter --mount=/run/ns/snapd/lxd.mnt mount -t zfs containers/abbymt4mt5 /var/snap/lxd/common/lxd/storage-pools/default/containers/abbymt4mt5
nsenter: cannot open /run/ns/snapd/lxd.mnt: No such file or directory

I ran but there is no file in here. what should I choose for --mount flag

I made it work by changing commands to following:

s# nsenter --mount=/run/snapd/ns/lxd.mnt mount -t zfs default/containers/abbymt4mt5 /var
/snap/lxd/common/lxd/storage-pools/default/containers/abbymt4mt5
s# lxd import abbymt4mt5

doh, oops, sorry, wrong path :wink: