Wednesday, September 10, 2008

HowTo: Mount NFS shares on FreeBSD

NFS (Network File System) is a nice and easy way to share files across Unix like systems such as *BSD, Solaris and Linux.

Here are the steps I took to enable the NFS client:
  1. % su
  2. # echo 'nfs_client_enable="YES"' >> /etc/rc.conf
  3. # echo 'nfs_client_flags="-n 4"' >> /etc/rc.conf
  4. # nfsiod -n 4
Basically steps 2 and 3 enable the NFS client at boot time, while step 4 starts the client immediately. In alternative to step 4 you can reboot or run /etc/rc.d/nfsclient start as root.

Now that we have the NFS client running we can proceed to accessing NFS shares. To mount NFS shares issue the following commands on the client:
  1. % su
  2. # mkdir /mnt/downloads
  3. # mount -v 192.168.1.101:/usr/local/downloads /mnt/downloads
Step 2 creates a directory in which to mount the remote share. On step 3 I've mounted a NFS share available on the 192.168.1.101 server (if you have hosts information properly configured you can use the server hostname instead).

And that's it. Pretty simple and straightforward.

No comments: