Sharing local storage as SMB or NFS share

inxsible

Active Member
Feb 6, 2020
139
8
38
Hello,

I am building a server and was wondering if there was a way to share the local proxmox storage as a SMB share or a NFS share over the local network. I googled but the only hits I found were related to adding a share to the proxmox or a LXC container. Nothing about using the proxmox storage as a share. This is to avoid having a separate storage server like FreeNAS or Xigmanas (whether in a VM or bare-metal)

I would think it is possible if I run samba or nfs server from the shell since it's just Debian after all. However, I didn't see any way to add services like Samba or NFS to the proxmox data store in the Web UI.
 
I would think it is possible if I run samba or nfs server from the shell since it's just Debian after all.
Yes, that works just fine. If you're using ZFS you can even use the built-in network sharing services (see here for example).

However, I didn't see any way to add services like Samba or NFS to the proxmox data store in the Web UI.
'Datacenter->Storage->Add', but if the storage is local it's probably faster to access it as a local disk (i.e. Directory storage or the like) and only use the network connection for remote clients.
 
Yes, that works just fine. If you're using ZFS you can even use the built-in network sharing services (see here for example).
Wonderful. Is there a reason why the built-in network sharing service works only if I am using ZFS and not just regular LVM based disks?
Datacenter->Storage->Add', but if the storage is local it's probably faster to access it as a local disk (i.e. Directory storage or the like) and only use the network connection for remote clients.
Correct. I intended to use the network connection only for remote clients. The Proxmox host will use it as a local storage or probably not use it at all. I intend to create a separate RAID array (either RAIDZ2 or RAID6) and then use this RAID only as a data storage. I just wanted to enable SMB or NFS on that storage, so remote clients can access this data. This would allow me to not have an extra VM -- only for serving files.
 
Last edited:
Wonderful. Is there a reason why the built-in network sharing service works only if I am using ZFS and not just regular LVM based disks?
Because the "built-in" network sharing is called "built-in" because it is, well, built-in to ZFS :)

It still uses the regular NFS/SMB servers behind the scenes, just that if you are using ZFS it makes administration a bit simpler. LVM doesn't have that feature, so you have to set it up manually - but it should still work just fine.
 
@Stefan_R trying to get this to work, and it does work very well but when i reboot the server (on updates, for example), it seems the nfs-kernel-server is trying to start before ZFS is mounted (and therefore fails). this results in all of my NFS shares being unavailable until i log into the server manually and start nfs-kernel-server myself.

this is obviously sub-optimal, in the case of scheduled reboots. is there a way to get the NFS server to wait until ZFS mount is complete before starting? i've tried everything i can think of (i.e. Before= / After= / Requires= / etc within the service definition), and nothing seems to work. every time i reboot the server, NFS fails (and complains about the ZFS mount locations not existing) until i log in and start it manually (after ZFS has finished mounting).
 
@Stefan_R trying to get this to work, and it does work very well but when i reboot the server (on updates, for example), it seems the nfs-kernel-server is trying to start before ZFS is mounted (and therefore fails). this results in all of my NFS shares being unavailable until i log into the server manually and start nfs-kernel-server myself.

this is obviously sub-optimal, in the case of scheduled reboots. is there a way to get the NFS server to wait until ZFS mount is complete before starting? i've tried everything i can think of (i.e. Before= / After= / Requires= / etc within the service definition), and nothing seems to work. every time i reboot the server, NFS fails (and complains about the ZFS mount locations not existing) until i log in and start it manually (after ZFS has finished mounting).

I'd be interested in seeing what's up with this as well. I'm wanting to enable ZFS's built-in NFS server, but I'll hold off if it's known to require manual restarting after reboots.
 
I'd be interested in seeing what's up with this as well. I'm wanting to enable ZFS's built-in NFS server, but I'll hold off if it's known to require manual restarting after reboots.

the way i have worked around this is by just adding a crontab to restart it 60 seconds after the server boots. so far, it has worked (knock on wood)...if i have issues i'll probably just extend the time out a bit, but this works for now.

Code:
@reboot /usr/bin/sleep 60 && /usr/bin/systemctl restart nfs-kernel-server

if there's a better way to handle it though, i'm all ears and would love to make this more efficient...
 
  • Like
Reactions: loneboat
this is basic sysadmin 101 - just add a systemd snippet to add the missing directives (e.g., RequiresMountsFor, or Wants and After)
 
to the service that is missing them? if you are struggling with this such an advanced setup requiring manual attention might not be the best way to go for you (e.g., you can always set up some file server with GUI configuration inside a VM instead..)

edit: e.g., https://wiki.archlinux.org/title/systemd#Drop-in_files gives you some hints if you want to read up further..
 
this is basic sysadmin 101 - just add a systemd snippet to add the missing directives (e.g., RequiresMountsFor, or Wants and After)

to the service that is missing them? if you are struggling with this such an advanced setup requiring manual attention might not be the best way to go for you (e.g., you can always set up some file server with GUI configuration inside a VM instead..)

With respect - you're coming off as almost hostile, @fabian.

@crackers819903 said they've already tried various combinations of directives in their systemd setup. This doesn't strike me as a "Help I'm a noob, I'm in completely over my head" post. It's more "Hey I've tried x, y, and z, and here are the [unexpected] results I'm getting". I don't think answers of "this is basic" and "this advanced setup isn't for you" are productive. If they're making a simple mistake/oversight, that's cool, just point that out. We all make simple mistakes sometimes.
 
Last edited:
  • Like
Reactions: crackers819903
sorry if it came off that way - that's obviously not my intention. I missed that the post from March was by the same user.

if you (as in, either of you attempting to set this up) want to double-check whether you made any mistakes or find out why what you expect to work doesn't, then posting what you actually did might help ;) we can't provide fool-proof step-by-step instructions for every setup under the sun, and especially things like custom boot ordering/dependencies are not something you can setup once following some tutorial without understanding how the components interact - so when in doubt, it's usually better to avoid that route and setup the service in question in a properly contained way.
 

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!