[SOLVED] Maximum number of bind mounts in a container

Sep 15, 2019
41
0
26
Hello togehter,
I want to bind mount 10 + x ZFS datasets into a lxc container. Is this an bad idea?
What is the maximum recommended number of bind mounts for a container?
According to man pct the bind mount limit seems to be 256 (mp0 - 255) is this assumption correct?

Thanks!
Chris
 
bindmounts are rather inexpensive, so it should be fine to use as many as you need.
 
  • Like
Reactions: chriskirsche
I also have a ton of nested ZFS datasets. Burnt through much of the evening trying to get rbind set up in LXC. In the end it was simple:

add your mounts to /etc/pve/lxc/<ctid>.conf :

lxc.mount.entry: /mnt/storagepool mnt/storagepool none rbind,create=dir,optional 0 0
lxc.mount.entry: /rpool/stuff mnt/stuff none rbind,create=dir,optional 0 0
lxc.apparmor.raw: mount,

then a reboot had me in business. I'm not sure the app armour line is needed but it doesn't seem to hurt.

I also needed to zfs set overlay=on rpool, or it wouldn't mount on reboot because of cruft that the bind leaves under the /rpool mountpoint.

The container is running the Turn Key Linux fileserver template and I can finally browse the shares there over Samba on the Mac.

Cheers
 
I also have a ton of nested ZFS datasets. Burnt through much of the evening trying to get rbind set up in LXC. In the end it was simple:

add your mounts to /etc/pve/lxc/<ctid>.conf :

lxc.mount.entry: /mnt/storagepool mnt/storagepool none rbind,create=dir,optional 0 0
lxc.mount.entry: /rpool/stuff mnt/stuff none rbind,create=dir,optional 0 0
lxc.apparmor.raw: mount,

then a reboot had me in business. I'm not sure the app armour line is needed but it doesn't seem to hurt.

I also needed to zfs set overlay=on rpool, or it wouldn't mount on reboot because of cruft that the bind leaves under the /rpool mountpoint.

The container is running the Turn Key Linux fileserver template and I can finally browse the shares there over Samba on the Mac.

Cheers
did this work on an unprivileg container? what promox version are you running? using these cmds my container isnt starting :/
 
did this work on an unprivileg container? what promox version are you running? using these cmds my container isnt starting :/

Mmm fair point. Didn’t cross my mind to try with unprivileged containers as for a local file server working with transposed UIDs would’ve been prohibitive. Now I think about it I can see use cases for what you’re asking.

I’m on v6.1 or 6.2 but either way it’s working since I posted
 
did this work on an unprivileg container? what promox version are you running? using these cmds my container isnt starting :/

I can verify that this also works on unprivileged containers. You will have to map IDs the same way you would need to for a mount using proxmox's mp# syntax though.

E.g.,
Code:
lxc.idmap: u 0 100000 65535
lxc.idmap: g 0 100000 65535

See the lxc man pages here: https://linuxcontainers.org/lxc/manpages/man5/lxc.container.conf.5.html for more info on lxc.idmap. Or, search the proxmox forums...there are several topics about using lxc.idmap.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!