layer7
(Oliver)
January 24, 2020, 1:17pm
1
Hi,
since running: 3.19/stable: 3.19 2020-01-24 (13098) 67MB -
This problem occures:
# lxd import lxc4102
Error: The container's directory "/var/snap/lxd/common/lxd/storage-pools/local-filestorage/containers/lxc4102" appears to be empty. Please ensure that the container's storage volume is mounted
#lxc storage list
+-------------------+-------------+--------+--------------------------------------+---------+
| NAME | DESCRIPTION | DRIVER | SOURCE | USED BY |
+-------------------+-------------+--------+--------------------------------------+---------+
| local-filestorage | | dir | /opt/storages/local-filestorage | 258 |
+-------------------+-------------+--------+--------------------------------------+---------+
# ls -la /opt/storages/local-filestorage/containers/lxc4102/
total 40
d--x------ 5 1000000 root 4096 Sep 9 09:59 .
drwxr-xr-x 141 root root 4096 Jan 24 14:02 ..
-r-------- 1 root root 3203 Dec 25 11:31 backup.yaml
drwx------ 2 root root 16384 Sep 9 09:59 lost+found
-rw-r--r-- 1 root root 275 Sep 9 09:59 metadata.yaml
dr-xr-xr-x 18 1000000 1000000 4096 Sep 8 09:23 rootfs
drwxr-xr-x 2 root root 4096 Jan 24 14:03 templates
So, normally this would work. It worked at least in the past to place the container files in a storage and to import it.
But now LXD started to look inside of the snap directory, where nothing, of course, is mounted.
So how to get this stuff how imported ?
Thank you !
Greetings
Oliver
tomp
(Thomas Parrott)
January 24, 2020, 1:25pm
2
Hi,
I will try and re-create this locally and see what the problem is.
tomp
(Thomas Parrott)
January 24, 2020, 1:54pm
3
So I just tried this, and it worked OK from the snap.
The storage pool should have been mounted into /var/snap/lxd/common/lxd/storage-pools/local-filestorage from /opt/storages/local-filestorage.
Can I ask how you created the storage pool record for an existing storage pool directory?
layer7
(Oliver)
January 24, 2020, 2:03pm
4
Hi,
thats an install that was running for month with 260 containers.
But this snap autoupdate, again, killed a lot.
Anyway, the storage was created just like the docu says it. Its for sure not the problem.
Snap does some hidden mount there in its tree, that i can not see:
# ls -lisa /var/snap/lxd/common/lxd/storage-pools/local-filestorage/
total 8
145162618 4 drwx--x--x 2 root root 4096 Apr 21 2019 .
145162612 4 drwx--x--x 3 root root 4096 Apr 21 2019 ..
But if you say you run the LXD snap 3.19 package and the lxd import works with old data, then i will have to try my luck with a reboot.
tomp
(Thomas Parrott)
January 24, 2020, 2:06pm
5
If you do
ps aux | grep lxd
Get PID of lxd process
sudo nsenter -t <LXD PID> -m
mount | grep local-filestorage
Then you should be able to see the mount.
tomp
(Thomas Parrott)
January 24, 2020, 2:09pm
6
I asked about creating the pool, as I was wondering how your container DB records were removed whilst the storage pool DB records still remained, really I am asking why do you need to import the container?
When I tried to simulate this, by first creating a container, and then removing the storage pool, when I tried to re-create the storage pool it wouldn’t let me create it with a non-empty directory.
Anyway, when LXD starts now, the storage pools are mounted, so this may resolve it for you.
layer7
(Oliver)
January 24, 2020, 2:12pm
7
Hi,
ah ok, no, i actually removed the lxd container to run this fix:
Hi,
this is about this base problem users of LXD encounter again and again with different storages when they try to start their containers, maybe just “out of nothing” or after a migration or update of lxd:
ERROR dir - storage/dir.c:dir_mount:198 - No such file or directory - Failed to mount "/var/snap/lxd/common/lxd/containers/XXX/rootfs" on "/var/snap/lxd/common/lxc/"
lxc lxc1101-1304 20191206172015.198 ERROR conf - conf.c:lxc_mount_rootfs:1353 - Failed to mount rootfs "/var/snap/l…
But, while this was working in the past, it does not work this time.
So if you want to try that on ur side, it would mean to
stop the $container
move /containers/$container somewhere else
delete $container
move the data back
execute lxd import $container
tomp
(Thomas Parrott)
January 24, 2020, 2:13pm
8
Got ya, ok will give it ago. I suspect an LXD restart will fix it, as 3.19 will mount storage pools on start now, but will test it.
tomp
(Thomas Parrott)
January 24, 2020, 2:16pm
9
Yep that works fine for me. Can you see if the mount is there for you inside the namespace and if not restart LXD?
layer7
(Oliver)
January 24, 2020, 2:24pm
10
Restarting LXD via snap did not work.
Going to reboot the server now
tomp
(Thomas Parrott)
January 24, 2020, 2:26pm
11
OK please can you show me the output of mount
from inside the lxd namespace, thanks.
layer7
(Oliver)
January 24, 2020, 2:44pm
12
Hi,
after a reboot:
# mount lxc4102-file-0 containers/lxc4102/
# lxd import lxc4102
… works.
I wonder why LXD always needs to give totally unneccessary hard times…
/dev/sda3 on /var/snap/lxd/common/lxd/storage-pools/local-filestorage type ext4 (rw,relatime)
/opt/storages/local-filestorage/lxc4102-file-0 on /var/snap/lxd/common/lxd/storage-pools/local-filestorage/containers/lxc4102 type ext4 (rw,relatime)
While actually this is mounted this way:
#mount /opt/storages/local-filestorage/lxc4102-file-0 /opt/storages/local-filestorage/containers/lxc4102/
These are qcow2 files we use to mount before we start the lxc container.
Anyway, Thomas, thank you very much for your feedback and help !
1 Like