NFS: Difference between revisions

From Leo's Notes
This page was last edited on 29 April 2013, at 18:40.
Created page with "== FreeBSD == To set a FreeBSD machine up as a NFS server, add the following lines to <code>/etc/rc.conf</code> mountd_enable="YES" nfs_server_enable="YES" rpcbind_enable..."
 
syntax highlight
Line 3: Line 3:
To set a FreeBSD machine up as a NFS server, add the following lines to <code>/etc/rc.conf</code>
To set a FreeBSD machine up as a NFS server, add the following lines to <code>/etc/rc.conf</code>


mountd_enable="YES"
<syntaxhighlight lang="text" line start="1" enclose="div">
nfs_server_enable="YES"
mountd_enable="YES"
rpcbind_enable="YES"
nfs_server_enable="YES"
rpc_lockd_enable="YES"
rpcbind_enable="YES"
rpc_statd_enable="YES"
rpc_lockd_enable="YES"
mountd_flags="-r"
rpc_statd_enable="YES"
mountd_flags="-r"
</syntaxhighlight>


Since <code>/storage</code> is a single mount, you will need to define the same directories exactly the same for all the different permissions you want to define in <code>/etc/exports</code>. For example:
Since <code>/storage</code> is a single mount, you will need to define the same directories exactly the same for all the different permissions you want to define in <code>/etc/exports</code>. For example:


/storage/downloads /storage/backups/esxi -ro -network 10.1.1.0 -mask 255.255.255.0
<syntaxhighlight lang="text" line start="1" enclose="div">
/storage/downloads /storage/backups/esxi -maproot=root -network 10.1.1.2 -mask 255.255.255.255
/storage/downloads /storage/backups/esxi -ro -network 10.1.1.0 -mask 255.255.255.0
/storage/downloads /storage/backups/esxi -maproot=root -network 10.1.1.2 -mask 255.255.255.255
</syntaxhighlight>


It would be '''invalid''' if the second line had only <code>/storage/downloads</code> as it will cause the first entry to be ignored by the parser.
It would be '''invalid''' if the second line had only <code>/storage/downloads</code> as it will cause the first entry to be ignored by the parser.
Line 19: Line 23:
To apply your changes, restart <code>mountd</code>.
To apply your changes, restart <code>mountd</code>.


service mountd restart
<syntaxhighlight lang="bash" line start="1" enclose="div">
showmount -e
service mountd restart
</syntaxhighlight>
 
<code>showmount</code> should show both exports:
<syntaxhighlight lang="bash" line start="1" enclose="div">
showmount -e
  Exports list on localhost:
  Exports list on localhost:
  /storage/downloads                10.1.1.0 10.1.1.2
  /storage/downloads                10.1.1.0 10.1.1.2
  /storage/backups/esxi              10.1.1.0 10.1.1.2
  /storage/backups/esxi              10.1.1.0 10.1.1.2
 
</syntaxhighlight>


[[Category:FreeBSD]]
[[Category:FreeBSD]]

Revision as of 18:40, 29 April 2013

FreeBSD

To set a FreeBSD machine up as a NFS server, add the following lines to /etc/rc.conf

mountd_enable="YES"
nfs_server_enable="YES"
rpcbind_enable="YES"
rpc_lockd_enable="YES"
rpc_statd_enable="YES"
mountd_flags="-r"

Since /storage is a single mount, you will need to define the same directories exactly the same for all the different permissions you want to define in /etc/exports. For example:

/storage/downloads /storage/backups/esxi -ro -network 10.1.1.0 -mask 255.255.255.0
/storage/downloads /storage/backups/esxi -maproot=root -network 10.1.1.2 -mask 255.255.255.255

It would be invalid if the second line had only /storage/downloads as it will cause the first entry to be ignored by the parser.

To apply your changes, restart mountd.

service mountd restart

showmount should show both exports:

showmount -e
 Exports list on localhost:
 /storage/downloads                 10.1.1.0 10.1.1.2
 /storage/backups/esxi              10.1.1.0 10.1.1.2