Simple question: I have my Debian LXC running. How do I get it to recognize the local filesystem, namely my attached and mounted HDDs?
I have searched the net but am not sure what to search for in the first place.
Simple question: I have my Debian LXC running. How do I get it to recognize the local filesystem, namely my attached and mounted HDDs?
I have searched the net but am not sure what to search for in the first place.
in the lxc config file add these two lines for e.g. sda1:
lxc.cgroup.devices.allow = b 8:1 rwm
lxc.hook.autodev = /srv/lxc/server/mknod.sh
Create mknod.sh according to the path above with this content:
#!/bin/sh
mknod ${LXC_ROOTFS_MOUNT}/dev/sda1 b 8 1
exit 0
8:1 is specific for sda1. If you want another file in /dev find it’s blockid by “ls -lah /dev” where you can see e. g. 8,1 for sda1:
brw-r–r-- 1 root root 8, 1 Dec 11 12:24 sda1
I think this will get you far
second option is using SAMBA. Or approaching each other through network.
Alternative:
add to lxc config:
lxc.mount = /srv/lxc/server/fstab
create fstab file according path above with this content (doesnt give you block level access to device though), mnt/backup is the path inside the container:
/dev/sda1 mnt/backup ext4 defaults 0 0