Dynamic mount of devices in container

Sac

New Member
Mar 29, 2023
2
0
1
I have an LXC container and I want to mount a loop device in it, it works as far as I get the /dev/loop0 and /dev/loop-control mounted and it can use /dev/loop0, but I'm trying to use it with losetup -P|--partscan which creates /dev/loop0p1 and /dev/loop0p2 which are not visible to the LXC container, but they show up in the host after I run losetup, but how do I get these so the container can also see them? Since they are created in the container I cannot simply lxc.mount.entry: them when I start the container
 
Yes, I can specify the device that way, I just tried and I can manually mount it using mknod, I suppose it fully works, I haven't tried yet

The question is more on how (if possible) to automate that the /dev/loop0p1 and /dev/loop0p2 gets mounted into the container directly with only losetup, so I don't have to predefine the node and manually call mknod to have it mounted in the container