Best way to expose an shared NFS dir to each container?

TutenStain

Active Member
Jan 25, 2017
3
0
41
32
Hello,
I have a server runing Proxmox with a few containers and a NAS which contains my bulk data, such as pictures, movies, executables etc. However, I have not managed to figure out how to expose my exported NAS NFS share to each container? Is the right way to first mount it on Proxmox and then create a mountpoint for each container?
 
Question for understanding:

A) Are you looking to expose containers to an external NFS-Share added to Proxmox via the Datacenter -> Storage view?
B) Are you looking to expose containers to an external NFS-Share by mounting said NFS-Share on multiple containers?


if A) then you are doing it wrong. You mount an external NFS-Share in Proxmox so you can use it to store your Container or KVM vDisks on it. (or use it to store backups on the NAS)

if B) then I'd create user accounts corresponding to the CT/VM's on said NAS, set appropriate access rights, and then google "how to mount NFS share in <distribution> <VersionNumber>" and then follow said instructions (probably via /etc/fstab) .


Bonus points for having separate Nics for the NAS-traffic (multiple vmbro or openvswitch based bridges) on which you create a seperate vNic for the purpose of separating NFS traffic from regular traffic) .


At least that is how I'd do it.
 
Last edited:
Question for understanding:

A) Are you looking to expose containers to an external NFS-Share added to Proxmox via the Datacenter -> Storage view?
B) Are you looking to expose containers to an external NFS-Share by mounting said NFS-Share on multiple containers?


if A) then you are doing it wrong. You mount an external NFS-Share in Proxmox so you can use it to store your Container or KVM vDisks on it. (or use it to store backups on the NAS)

if B) then I'd create user accounts corresponding to the CT/VM's on said NAS, set appropriate access rights, and then google "how to mount NFS share in <distribution> <VersionNumber>" and then follow said instructions (probably via /etc/fstab) .


Bonus points for having separate Nics for the NAS-traffic (multiple vmbro or openvswitch based bridges) on which you create a seperate vNic for the purpose of separating NFS traffic from regular traffic) .


At least that is how I'd do it.

Thanks.

If I do the A approach, is it possible to mount the NAS share via GUI, but to not actually store the container or KVM disk on it, just mount a remote directory via NFS with existing data? This remote directory could then easily be given to each container.

If not, I can do the B approach. However, that means that I have to manually alter fstab for each container which would be a bit time consuming.
 
If I do the A approach, is it possible to mount the NAS share via GUI, but to not actually store the container or KVM disk on it, just mount a remote directory via NFS with existing data? This remote directory could then easily be given to each container.


For your usecase B) is the only option (as in sharing a single NFS-Share between multiple VM's/ Container aka the "Guest") - afaik.

What I described as A) is the process you choose on the "HOST" when you want to host the VM/CT's virtual Disk (vDisks) on the NFS-Share (as opposed to your local storage). It is NOT used to share the same share between CT's or VM's!

Some more reading:


https://pve.proxmox.com/wiki/Storage
https://pve.proxmox.com/wiki/Storage:_NFS


Think about it this way (way dumbed down):
Your CT/VM essentially is nothing more than a "Computer" running a "OperatingSystem". Just because you moved it from the physical world to the virtual world, does not change how you "make a software work" on said system.
 
Last edited:

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!