Hello,
I wonder what the best practice is how to mount NAS to a LXC?
My setup (all on one Proxmox server (PVE)):
I encountered several challenges here/What I already achieved/tried:
I don't know if this seems like an edge use case, but the urge to store files on a NAS which is virtualized on the same hardware as LXCs, and then access the NAS on these LXCs doesn't seem strange to me?!
Let me know your thoughts. Curious to learn more about proxmox.
Thanks!
I wonder what the best practice is how to mount NAS to a LXC?
Why? Reason: I don't want to estimate and manage the size of the LXC data storages in a containers, etc. (e.g. jellyfin, nextcloud, etc.) + have all the advantages of user management etc. of a NAS system. I basically just want to manage all files/storages for several containers on one big NAS. This seems easier to me, but I am open to suggestions. Maybe I am overlooking something. (Or maybe I should ask more generally: How do you best store huge amounts of data which must be used inside LXCs?)
My setup (all on one Proxmox server (PVE)):
- NAS: VM with openmediavault (omv).
qm set 101 -scsi1 /dev/disk/by-id/ata-WDC_....
to pass hard drive through to omv so omv can do its job (manage spin downs, power savings, user management, network access, etc.) (btw. the hard drive pass through setup is the reason why this is a VM. This is afaik not possible with LXCs.)- Open folders on OMV via NFS to the LAN.
- LXC Container which should use the NFS from omv as "big storage", e.g. nextcloud (nc):
- I want to store the app data and DB of nc on my proxmox ssd directly. No issues here.
- I want the nc data (i.e., user files like pictures, etc.) on the omv (via NFS).
I encountered several challenges here/What I already achieved/tried:
I cannot mount NFSs in an unprivileged LXC. Big problem, especially for nextcloud which should be accessibly from the internet, if you recognize the security issues.
- Workaround: Mount the NFS to the PVE. Not possible, because OMV is a VM running on the PVE, so it obviously boots after PVE. Solution: Wait for OMV to boot, then mount the NFS to the PVE host (
mount -t nfs 192.168.178.121:/data-storage-on-omv /mnt/data-storage/
, then start the containers (which are configured with something like this:pct set 102 -mp0 /mnt/omv/data-storage,mp=/mnt/datastorage-on-omv,acl=1
). - This is a dirty solution due to the manual steps for mounting (can be automated with a little bash script, still ugly solution).
- This solution doesnt really work for some use cases. E.g. nextcloud requires the user data files to be owned by linux user "www-data". But if I write something from the nextcloud LXC, the NAS (omv) recognizes the file as from user "1000000", group "users". I assume that the issue is with proxmox, because user and group get preserved when I create files from the PVE console.
I don't know if this seems like an edge use case, but the urge to store files on a NAS which is virtualized on the same hardware as LXCs, and then access the NAS on these LXCs doesn't seem strange to me?!
Let me know your thoughts. Curious to learn more about proxmox.
Thanks!