Had to reinstall my OS drive, how do I get my containers back?


(mjr2015) #1

had to reinstall my os drive and i’m trying to figure out how to recover my containers again - I thought that since I was on snap before and i’m still on the snap i could just lxd import but it’s saying

@SERVER:~$ sudo lxc storage create DATA zfs source=DATA/LXD
Error: Provided ZFS pool (or dataset) isn't empty

@SERVER:~$ sudo lxd import caddy
Error: The container "caddy" does not seem to exist on any storage pool

My original pool is stored in pool DATA/LXD

DATA/LXD/containers/ansible                                                               1.23G  45.3G  1.17G  /var/snap/lxd/common/lxd/storage-pools/DATA/containers/ansible
DATA/LXD/containers/caddy                                                                  946M  45.6G  1.03G  /var/snap/lxd/common/lxd/storage-pools/DATA/containers/caddy
DATA/LXD/containers/jackett                                                               1.65G  44.9G  1.68G  /var/snap/lxd/common/lxd/storage-pools/DATA/containers/jackett
DATA/LXD/containers/log                                                                   10.0G  5.44T  6.26G  /var/snap/lxd/common/lxd/storage-pools/DATA/containers/log
DATA/LXD/containers/nagios                                                                10.2G  5.44T  7.13G  /var/snap/lxd/common/lxd/storage-pools/DATA/containers/nagios
DATA/LXD/containers/owncloud                                                              2.59G  44.0G  2.61G  /var/snap/lxd/common/lxd/storage-pools/DATA/containers/owncloud
DATA/LXD/containers/tbx                                                                   1.74G  44.8G  1.53G  /var/snap/lxd/common/lxd/storage-pools/DATA/containers/tbx
DATA/LXD/containers/unifi                                                                 3.12G  5.44T  2.12G  /var/snap/lxd/common/lxd/storage-pools/DATA/containers/unifi
DATA/LXD/containers/uvideo                                                                36.4G  10.2G  4.89G  /var/snap/lxd/common/lxd/storage-pools/DATA/containers/uvideo

I lxd init

and made this

@SERVER:~$ sudo lxc profile show default
config: {}
description: Default LXD profile
devices:
  eth0:
    name: eth0
    nictype: macvlan
    parent: VLAN20
    type: nic
name: default
used_by: []

how do i recover my containers?


(Stéphane Graber) #2

lxd import only works when the container is mounted at its usual location, so manually creating and mounting the relevant storage-pools/POOL/containers/NAME path should make lxd import happy.


(Stéphane Graber) #3

The first container you import will re-add the storage pool for you, avoiding the check you ran into (that’s why we prevent you from adding it, it needs to be done through import if already populated).


(mjr2015) #4

So I mounted them all but looks like i still get a snapshot error

root@SERVER:~# zfs mount DATA/LXD/containers/caddy
root@SERVER:~# lxd import caddy
Error: There are either snapshots that don't exist on disk anymore or snapshots that are not recorded in the "backup.yaml" file. Pass "force" to remove them

do i need to destroy all of my snapshots?


(Stéphane Graber) #5

Can you show zfs list -t all?


(mjr2015) #6
DATA/LXD                                                                                           71.6G  5.44T   128K  none
DATA/LXD/containers                                                                                67.9G  5.44T   128K  none
DATA/LXD/containers/ansible                                                                        1.18G  45.4G  1.19G  /var/snap/lxd/common/lxd/storage-pools/DATA/containers/ansible
DATA/LXD/containers/ansible@snapshot-snap22                                                        97.1M      -  1.15G  -
DATA/LXD/containers/ansible@snapshot-snap23                                                        96.7M      -  1.15G  -
DATA/LXD/containers/ansible@snapshot-snap24                                                         102M      -  1.15G  -
DATA/LXD/containers/ansible@snapshot-snap25                                                        96.1M      -  1.16G  -
DATA/LXD/containers/ansible@snapshot-snap26                                                        90.3M      -  1.17G  -
DATA/LXD/containers/ansible@snapshot-snap27                                                        85.5M      -  1.17G  -
DATA/LXD/containers/ansible@snapshot-snap28                                                        4.65M      -  1.19G  -
DATA/LXD/containers/caddy                                                                           988M  45.6G  1.05G  /var/snap/lxd/common/lxd/storage-pools/DATA/containers/caddy
DATA/LXD/containers/caddy@snapshot-snap13                                                          95.4M      -  1008M  -
DATA/LXD/containers/caddy@snapshot-snap14                                                          94.9M      -  1008M  -
DATA/LXD/containers/caddy@snapshot-snap15                                                           102M      -  1015M  -
DATA/LXD/containers/caddy@snapshot-snap16                                                          99.3M      -  1.01G  -
DATA/LXD/containers/caddy@snapshot-snap17                                                          97.9M      -  1.02G  -
DATA/LXD/containers/caddy@snapshot-snap18                                                          96.5M      -  1.03G  -
DATA/LXD/containers/caddy@snapshot-snap19                                                          18.8M      -  1.05G  -
DATA/LXD/containers/jackett                                                                        1.65G  44.9G  1.69G  /var/snap/lxd/common/lxd/storage-pools/DATA/containers/jackett
DATA/LXD/containers/jackett@snapshot-snap7                                                         99.1M      -  1.65G  -
DATA/LXD/containers/jackett@snapshot-snap8                                                         98.7M      -  1.65G  -
DATA/LXD/containers/jackett@snapshot-snap9                                                         98.6M      -  1.65G  -
DATA/LXD/containers/jackett@snapshot-snap10                                                        90.4M      -  1.66G  -
DATA/LXD/containers/jackett@snapshot-snap11                                                        89.4M      -  1.68G  -
DATA/LXD/containers/jackett@snapshot-snap12                                                        85.5M      -  1.68G  -
DATA/LXD/containers/jackett@snapshot-snap13                                                        7.57M      -  1.69G  -
DATA/LXD/containers/log                                                                            9.88G  5.44T  6.27G  /var/snap/lxd/common/lxd/storage-pools/DATA/containers/log
DATA/LXD/containers/log@snapshot-snap20                                                             523M      -  6.13G  -
DATA/LXD/containers/log@snapshot-snap21                                                             275M      -  6.15G  -
DATA/LXD/containers/log@snapshot-snap22                                                             144M      -  5.98G  -
DATA/LXD/containers/log@snapshot-snap23                                                             220M      -  6.12G  -
DATA/LXD/containers/log@snapshot-snap24                                                             216M      -  6.24G  -
DATA/LXD/containers/log@snapshot-snap25                                                             107M      -  6.31G  -
DATA/LXD/containers/log@snapshot-snap26                                                             116M      -  6.35G  -
DATA/LXD/containers/nagios                                                                         9.91G  5.44T  7.21G  /var/snap/lxd/common/lxd/storage-pools/DATA/containers/nagios
DATA/LXD/containers/nagios@snapshot-snap20                                                          472M      -  7.18G  -
DATA/LXD/containers/nagios@snapshot-snap21                                                          307M      -  7.19G  -
DATA/LXD/containers/nagios@snapshot-snap22                                                          315M      -  7.19G  -
DATA/LXD/containers/nagios@snapshot-snap23                                                          333M      -  7.24G  -
DATA/LXD/containers/nagios@snapshot-snap24                                                          276M      -  7.25G  -
DATA/LXD/containers/nagios@snapshot-snap25                                                          159M      -  7.15G  -
DATA/LXD/containers/nagios@snapshot-snap26                                                          124M      -  7.21G  -
DATA/LXD/containers/owncloud                                                                       2.60G  44.0G  2.63G  /var/snap/lxd/common/lxd/storage-pools/DATA/containers/owncloud
DATA/LXD/containers/owncloud@snapshot-snap13                                                        101M      -  2.60G  -
DATA/LXD/containers/owncloud@snapshot-snap14                                                        100M      -  2.60G  -
DATA/LXD/containers/owncloud@snapshot-snap15                                                        102M      -  2.60G  -
DATA/LXD/containers/owncloud@snapshot-snap16                                                       96.5M      -  2.61G  -
DATA/LXD/containers/owncloud@snapshot-snap17                                                       93.9M      -  2.61G  -
DATA/LXD/containers/owncloud@snapshot-snap18                                                       87.4M      -  2.61G  -
DATA/LXD/containers/owncloud@snapshot-snap19                                                       86.7M      -  2.63G  -
DATA/LXD/containers/tbx                                                                            1.73G  44.8G  1.56G  /var/snap/lxd/common/lxd/storage-pools/DATA/containers/tbx
DATA/LXD/containers/tbx@snapshot-snap21                                                             138M      -  1.47G  -
DATA/LXD/containers/tbx@snapshot-snap22                                                             124M      -  1.49G  -
DATA/LXD/containers/tbx@snapshot-snap23                                                             119M      -  1.49G  -
DATA/LXD/containers/tbx@snapshot-snap24                                                             116M      -  1.52G  -
DATA/LXD/containers/tbx@snapshot-snap25                                                             112M      -  1.53G  -
DATA/LXD/containers/tbx@snapshot-snap26                                                            89.5M      -  1.54G  -
DATA/LXD/containers/tbx@snapshot-snap27                                                            92.7M      -  1.55G  -
DATA/LXD/containers/unifi                                                                          3.37G  5.44T  2.13G  /var/snap/lxd/common/lxd/storage-pools/DATA/containers/unifi
DATA/LXD/containers/unifi@snapshot-snap19                                                           144M      -  2.03G  -
DATA/LXD/containers/unifi@snapshot-snap20                                                           143M      -  2.05G  -
DATA/LXD/containers/unifi@snapshot-snap21                                                           415M      -  2.08G  -
DATA/LXD/containers/unifi@snapshot-snap22                                                           133M      -  2.10G  -
DATA/LXD/containers/unifi@snapshot-snap23                                                           115M      -  2.11G  -
DATA/LXD/containers/unifi@snapshot-snap24                                                           105M      -  2.12G  -
DATA/LXD/containers/unifi@snapshot-snap25                                                          89.4M      -  2.12G  -
DATA/LXD/containers/uvideo                                                                         36.6G  10.0G  5.19G  /var/snap/lxd/common/lxd/storage-pools/DATA/containers/uvideo
DATA/LXD/containers/uvideo@snapshot-snap17                                                         4.21G      -  5.94G  -
DATA/LXD/containers/uvideo@snapshot-snap18                                                          412M      -  2.14G  -
DATA/LXD/containers/uvideo@snapshot-snap19                                                         1.63G      -  5.15G  -
DATA/LXD/containers/uvideo@snapshot-snap20                                                         12.1G      -  16.8G  -
DATA/LXD/containers/uvideo@snapshot-snap21                                                         12.5G      -  17.2G  -
DATA/LXD/containers/uvideo@snapshot-snap22                                                          307M      -  5.04G  -
DATA/LXD/containers/uvideo@snapshot-snap23                                                          385M      -  5.18G  -
DATA/LXD/custom                                                                                     128K  5.44T   128K  none
DATA/LXD/custom-snapshots                                                                           128K  5.44T   128K  none
DATA/LXD/deleted                                                                                   2.95G  5.44T   128K  none
DATA/LXD/deleted/images                                                                            2.95G  5.44T   128K  none
DATA/LXD/deleted/images/84a71299044bc3c3563396bef153c0da83d494f6bf3d38fecc55d776b1e19bf9            767M  5.44T   767M  none
DATA/LXD/deleted/images/84a71299044bc3c3563396bef153c0da83d494f6bf3d38fecc55d776b1e19bf9@readonly     0B      -   767M  -
DATA/LXD/deleted/images/dcbc8e3e5c2ed9fb21c3d0659a0eee004bde52fac6616bc1453717032e52a700            768M  5.44T   768M  none
DATA/LXD/deleted/images/dcbc8e3e5c2ed9fb21c3d0659a0eee004bde52fac6616bc1453717032e52a700@readonly     0B      -   768M  -
DATA/LXD/deleted/images/e09ab6e15980dad3405c14d7d8a4d667870724273f22f43899d28c7f56fc45f7            718M  5.44T   718M  none
DATA/LXD/deleted/images/e09ab6e15980dad3405c14d7d8a4d667870724273f22f43899d28c7f56fc45f7@readonly     0B      -   718M  -
DATA/LXD/deleted/images/e2e78049292218f4f2fa1bb359edb409827475437164d1c5767807784c040a66            768M  5.44T   768M  none
DATA/LXD/deleted/images/e2e78049292218f4f2fa1bb359edb409827475437164d1c5767807784c040a66@readonly     0B      -   768M  -
DATA/LXD/images                                                                                     769M  5.44T   128K  none
DATA/LXD/images/b7c4dbea897f09f29474c8597c511b57c3b9c0d6f98dc42f257c64e76fea8c92                    769M  5.44T   769M  none
DATA/LXD/images/b7c4dbea897f09f29474c8597c511b57c3b9c0d6f98dc42f257c64e76fea8c92@readonly             0B      -   769M  -
DATA/LXD/snapshots                                                                                 1.62M  5.44T   128K  none
DATA/LXD/snapshots/ansible                                                                          128K  5.44T   128K  none
DATA/LXD/snapshots/caddy                                                                            128K  5.44T   128K  none
DATA/LXD/snapshots/jackett                                                                          128K  5.44T   128K  none
DATA/LXD/snapshots/log                                                                              128K  5.44T   128K  none
DATA/LXD/snapshots/log2                                                                             128K  5.44T   128K  none
DATA/LXD/snapshots/nagios                                                                           128K  5.44T   128K  none
DATA/LXD/snapshots/nagios2                                                                          128K  5.44T   128K  none
DATA/LXD/snapshots/owncloud                                                                         128K  5.44T   128K  none
DATA/LXD/snapshots/rproxy2                                                                          128K  5.44T   128K  none
DATA/LXD/snapshots/tbx                                                                              128K  5.44T   128K  none
DATA/LXD/snapshots/unifi                                                                            128K  5.44T   128K  none
DATA/LXD/snapshots/uvideo                                                                           128K  5.44T   128K  none

(Stéphane Graber) #7

Ok, can you try running lxd import with --force for one of your containers, then check that lxc info for that container looks good (as in, has any needed snapshot).