[lxc-users] Adding a host block device to a container

Peter Steele pwsteele at gmail.com
Mon Aug 31 21:13:45 UTC 2015


This is likely a newbie question but here goes...

I have some privileged containers that need access to certain block 
devices available on their host. For example, I'd like /dev/sda3 to be 
accessible from my container test. The major/minor values for this 
device is:

# ll /dev/sda3
brw-rw---- 1 root disk 8, 3 Aug 31 12:49 /dev/sda3

According to the documentation to import this device into a container I 
need to define the the parameter lxc.cgroup.devices.allow, so I added 
the following line to /var/lib/lxc/test/config:

lxc.cgroup.devices.allow = b 8:3 rwm

and restarted my container. This didn't seem to do the trick through. 
Running this command on the host however did do the trick:

# mknod -m 777 /var/lib/lxc/test/rootfs.dev/sda3 b 8 3

I assume the parameter lxc.cgroup.devices.allow is intended to do 
something like this in an automated fashion, and I'd rather use this 
parameter than running mknod explicitly. What am I missing?




More information about the lxc-users mailing list