Mounting an NFS share on a Linux Client
Assuming you have already configured NFS on the server, you can now proceed to map any exported drives from your Linux clients! The first step is to logon to each client and install the NFS client software using the following command:
sudo apt-get install portmap nfs-common
The output will look something like this:
$ sudo apt-get install portmap nfs-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libgssglue1 libnfsidmap2 librpcsecgss3
The following NEW packages will be installed
libgssglue1 libnfsidmap2 librpcsecgss3 nfs-common portmap
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 354kB of archives.
After this operation, 1,188kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://gb.archive.ubuntu.com/ubuntu/ maverick/main libgssglue1 i386 0.1-4 [22.4kB]
Get:2 http://gb.archive.ubuntu.com/ubuntu/ maverick/main libnfsidmap2 i386 0.23-2 [29.1kB]
Get:3 http://gb.archive.ubuntu.com/ubuntu/ maverick/main librpcsecgss3 i386 0.19-2 [33.1kB]
Get:4 http://gb.archive.ubuntu.com/ubuntu/ maverick-updates/main portmap i386 6.0.0-2ubuntu1.1 [38.0kB]
Get:5 http://gb.archive.ubuntu.com/ubuntu/ maverick-updates/main nfs-common i386 1:1.2.2-1ubuntu1.1 [232kB]
Fetched 354kB in 0s (493kB/s)
Preconfiguring packages ...
Selecting previously deselected package libgssglue1.
(Reading database ... 150613 files and directories currently installed.)
Unpacking libgssglue1 (from .../libgssglue1_0.1-4_i386.deb) ...
Selecting previously deselected package libnfsidmap2.
Unpacking libnfsidmap2 (from .../libnfsidmap2_0.23-2_i386.deb) ...
Selecting previously deselected package librpcsecgss3.
Unpacking librpcsecgss3 (from .../librpcsecgss3_0.19-2_i386.deb) ...
Selecting previously deselected package portmap.
Unpacking portmap (from .../portmap_6.0.0-2ubuntu1.1_i386.deb) ...
Selecting previously deselected package nfs-common.
Unpacking nfs-common (from .../nfs-common_1%3a1.2.2-1ubuntu1.1_i386.deb) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot
Setting up libgssglue1 (0.1-4) ...
Setting up libnfsidmap2 (0.23-2) ...
Setting up librpcsecgss3 (0.19-2) ...
Setting up portmap (6.0.0-2ubuntu1.1) ...
portmap start/running, process 2704
Setting up nfs-common (1:1.2.2-1ubuntu1.1) ...
Creating config file /etc/idmapd.conf with new version
Creating config file /etc/default/nfs-common with new version
Adding system user `statd' (UID 117) ...
Adding new user `statd' (UID 117) with group `nogroup' ...
Not creating home directory `/var/lib/nfs'.
statd start/running, process 2928
gssd stop/pre-start, process 2958
idmapd stop/pre-start, process 2991
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Next, we need to create the directory that we wish to mount the exported directory as - in this case, we want to access it as /mySharedData, so we first create that directory:
$ mkdir /mySharedData
Now we add a line to the /etc/fstab file, so the system can mount the drive at startup time, using the following format:
<NFS Server>:<NFS Exported directory> nfs rsize=8192,wsize=8192,timeo=14,intr
192.168.1.1:/export/myData /mySharedData nfs rsize=8192,wsize=8192,timeo=14,intr
Note: use these hard-coded options until you are more familiar with what they all mean: they are a good compromise to get you going!
Restart the port mapping software, to read in the changes:
sudo /etc/init.d/portmap restart
The output should look as follows:
$ sudo /etc/init.d/portmap restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service portmap restart
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the restart(8) utility, e.g. restart portmap
portmap start/running, process 780
Finally, manually mount the NFS share and check that you can see the files on the remote share prior to a reboot:
$ mount -a
$ ls /mySharedData
Don't forget to check the NFS mount is still accessible from the client:
- After you reboot the client
- After you reboot the server