Shared directory between LXD containers?

storage

#1

Hi. I currently use a server for Unifi, downloading, storage, and some other stuff. I’m afraid that if I mess something up, I have to re-do my whole server. Since it’s running quite a bit at the moment, that’d be tedious to do.

So I’ve been playing with the idea of making them all separate LXD containers. I’ve worked with it before, and it works very smooth. The thing is, I’d like to have several LXD containers to have access to my (current) /storagedirectory. This is a separate Software RAID apart from my OS installation.

Would it be possible to have access to the /storage from multiple containers? If yes, how would one set that up?

Thank you very much!


#2

You can create the shared directory on the host and then expose it to all the necessary containers with lxc device add ... disk ... (gets bindmounted).

If you create many such containers, you can add that instruction to a profile so that it gets added automatically to newly created containers.