Install and configure NFS Client on FreeBSD
I will show you in this tutorial how to setup and configure NFS client on FreeBSD system, you can read too, How to install and configure NFS Server on FreeBSD
NFS Client installation
On FreeBSD system, NFS client is installed by default but is disabled, no worry about NFS installation just you need to enabled it.
Enabling NFS Client
To enable NFS Client you require to edit the file /etc/rc.conf with the following command :
nano /etc/rc.conf
And to add the following two lines to it (to bottom of file) :
nfs_client_enable="YES"
nfs_client_flags="-n 4"
Then, You should now restart your machine where NFS client is configured, or alternatively, you can start NFS service manually without rebooting the machine (for first time) with :
nfsiod -n 4
NFS Client Configuration
First, lets create a test directory and name it nfs_dir with the following command :
mkdir /media/nfs_dir
Next step, is to mount a remote share directory /root/my_shared_dir on NFS Server to your newly created folder /media/nfs_dir (this process is similar to mount file system partitions on local hard drive, the difference on NFS mounting : no partition is need to mount it only you require to mount a remote shared directory provided by NFS Server machine), make sure that no firewall is blocking connections between Server/Client in your network :
mount -t nfs 192.168.8.33:/root/my_shared_dir /media/nfs_dir
192.168.8.33 : is the ip address of NFS Server.
/root/my_shared_dir : is a remote shared directory.
You can check your mount, if successfully is mounted by :
df -h
root@freebsdclt:~ # df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/ada0s1a 15G 4.1G 9.3G 31% /
devfs 1.0K 1.0K 0B 100% /dev
/dev/ada1p1 2.7G 1.8G 762M 70% /var
/dev/ada2p1 2.0G 32K 1.9G 0% /tmp
192.168.8.33:/root/my_shared_dir 12G 1.6G 9.1G 15% /media/nfs_dir
You can now read/write data (files/directories) to your mount point /media/nfs_dir
You can monitor and display available remote mounts on NFS Server from client machine with showmount command :
showmount -e your_nfs_server_ip_address
Example :
root@freebsdclt:~ # showmount -e 192.168.8.33
Exports list on 192.168.8.33:
/root/my_shared_dir 192.168.8.31
You can read more about mounting file systems on man documentation :
man mount
On the next tutorial, I will show you how to monitor your NFS Server.