A service of Daily Data, Inc.
Contact Form

User Tools

Site Tools


unix:freebsd:system_builds:nfsserver

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
unix:freebsd:system_builds:nfsserver [2019/09/21 22:26] – [Configure and start NFS] rodolicounix:freebsd:system_builds:nfsserver [2026/04/14 18:29] (current) rodolico
Line 8: Line 8:
  
 We also want to export to a couple of running virtuals to store large amounts of data. Since they have public interfaces, we need to set up our nfs server to only allow limited access to our nfs server, both by limiting through nfs and also with firewalls. We also want to export to a couple of running virtuals to store large amounts of data. Since they have public interfaces, we need to set up our nfs server to only allow limited access to our nfs server, both by limiting through nfs and also with firewalls.
 +
 +===== Devuan (Debian) =====
 +
 +Linux does not, by default, install an nfs server. To install (Devuan, Debian derivative)
 +
 +<code bash>
 +apt install -y nfs-kernel-server
 +</code>
 +
 +Also, the syntax for /etc/exports is slightly different for nfs v2 and 3
 +<code>
 +/srv/nfs 192.0.2.10(rw,sync,no_subtree_check,no_root_squash)
 +</code>
 +
 +And the way to start/restart nfsd is
 +
 +<code bash>
 +exportfs -ra # re-export filesystems
 +exportfs -v # view exports
 +/etc/init.d/nfs-kernel-server restart
 +</code>
 +
 +
  
 ===== Set up storage space ===== ===== Set up storage space =====
Line 37: Line 60:
  
 <code bash exports> <code bash exports>
-/media/nfsroot/dom0  -alldirs  10.81.210.37 10.81.210.32 +/media/nfs_root/dom0  -alldirs  10.81.210.37 10.81.210.32 
-/media/nfsroot/simon  -maproot=root  192.168.150.68 +/media/nfs_root/simon  -maproot=root  192.168.150.68 
-/media/nfsroot/strax  -maproot=root  strax.example.com+/media/nfs_root/strax  -maproot=root  strax.example.com
 </code> </code>
  
Line 61: Line 84:
 rpcbind_enable="YES" rpcbind_enable="YES"
 nfs_server_enable="YES" nfs_server_enable="YES"
 +mountd_enable="YES"
 +
 # the -h below binds nfsd to a specific IP, so a machine with # the -h below binds nfsd to a specific IP, so a machine with
 # multiple IP's will only respond if this one is used for the # multiple IP's will only respond if this one is used for the
Line 75: Line 100:
 Note the mountd_flags entry. mountd is what actually handles the mount request from clients. The -r flag allows individual files to be mounted, such as swap a swap file, or a virtual image. Additional flags may be specified. See //man 5 mountd// for more information. Two nice ones are the -h and -p flags which allow you to specify the IP and Port mountd will listen on. Note the mountd_flags entry. mountd is what actually handles the mount request from clients. The -r flag allows individual files to be mounted, such as swap a swap file, or a virtual image. Additional flags may be specified. See //man 5 mountd// for more information. Two nice ones are the -h and -p flags which allow you to specify the IP and Port mountd will listen on.
  
 +===== Maintenance =====
 +
 +If you need to add/remove/modify the NFS shares, create/modify any file systems on the server, then add/edit the appropriate stanzas to /etc/exports. Once you have done that, tell mountd to re-read the configuration:
 +<code bash>
 +service mountd reload
 +</code>
  
 +At this point, the modifications will be in effect. NOTE, if you have modified a share which was mounted, you should umount it, make the changes, then remount.
 ===== Links ===== ===== Links =====
   * https://www.freebsd.org/doc/handbook/network-nfs.html   * https://www.freebsd.org/doc/handbook/network-nfs.html
unix/freebsd/system_builds/nfsserver.1569122763.txt.gz · Last modified: by rodolico