Tag Archives: lxc

How to mount disk to LXC container

It`s rather simple.
just mount disk via fstab to host system:

root@sfa2 ~ # cat /etc/fstab | grep sdc1
/dev/sdc1       /mnt/sdc1   ext4     noatime,nodiratime      0 0

and add mount with bind to your LXC fstab, usually located at

root@sfa2 ~ # cat /var/lib/lxc/dbslave1-1/config | grep fstab
lxc.mount
.entry
= /var/lib/lxc/dbslave1-1/fstab

Now restart container and enjoy.

root@sfa2 ~ # cat /var/lib/lxc/dbslave1-1/fstab
proc            proc         proc    nodev,noexec,nosuid 0 0
sysfs           sys          sysfs defaults  0 0
/mnt/sdc1       /var/lib/lxc/dbslave1-1/rootfs/sdc1  none bind     0 0

BTW: Your cannot see remained space via df -h. I don`t know how to solve this issue 🙁 🙁 🙁