Linux VMs access to host storage

Hello!

I’m trying to find the best way to access my host storage from my VMs.

I did this:

lxc config device add uvm main disk source=/mnt/main/ path=/mnt/main/

and it just works. I have my “main” directory accesible from inside my VM. But it sometimes fails, saying “file doesn’exists” or “file handle in disuse”. Maybe this is a bug, or it shouldn’t be allowed to use this “device add” in this way with VMs?

I turned to sshfs and by now it is working 100%.

Using a disk device like you have described is correct.
Do you have a reproducer for those errors? Or more info about when it occurs/what scenario?

It is happening to me in an Ubuntu VM and in an Archlinux (lxqt) VM. In Ubuntu I’ve observed this behavior when accessing files and directories from inside certain tools, but in Arch it happens from pcmanfm-qt too. Trying to copy or move files causes the ‘file handle in disuse’ error.

in terminal/midnight commander it occurs too.

If you want some log or something, please ask.

Regards

If you can recreate reproducer steps then we can take a look and see whats going on.