Mount NFS on node works, on lxc debian container not

MikeC

Renowned Member
Jan 11, 2016
72
0
71
Bay Area, California
Hey all.

I have a share from a MacMini that I'd like to make available on one of my LXCs. I first tried mounting it on the proxmox node with no problem using "mount 192.168.1.25:/datadir /mnt/mac".

However, I get strange errors when I try the same command on the container.

root@trin3:/mnt# mount 192.168.1.25:/datadir /mnt
mount: 192.168.1.25:/datadir is write-protected, mounting read-only
mount: cannot mount 192.168.1.25:/datadir read-only

I can't find clear directions on how to do this. I read somewhere about apparmor, so I stopped that service temporarily on the node to see if it made any difference, which it didn't.

If it's already mounted on the node, shouldn't it be trivial to share it into the containers? Why can't we just use 'mount' from within the containers to mount NFS as needed directly from an NFS server on the network? Is this documented anywhere?

Thanks
 
you can use a bind mount to make the mount point from the host available in the container:

first, mount the NFS share:
Code:
mount 192.168.1.25:/datadir /mnt/mac

then add the directory /mnt/mac as bind mount to the container configuration (pick a free mpX slot, e.g., mp0):
Code:
pct set CONTAINER_ID -mpX /mnt/mac,mp=/path/inside/the/container

note that this mount point will be skipped when backing up the container!

see http://pve.proxmox.com/pve-docs/pve-admin-guide.html#pct_mount_points for some details
 
That looks pretty easy!
Is the "Resources -> Mount Point" option in the GUI the same thing, or do I have to add the mount info directly into the container's config?
 
That looks pretty easy!
Is the "Resources -> Mount Point" option in the GUI the same thing, or do I have to add the mount info directly into the container's config?

it's the same thing - but adding bind or device mount points is limited to the root user and not currently exposed over the GUI. you can remove them using the GUI though, and change options like "ro" and "acl".
 

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!