Saturday, October 2, 2010

Mount and NFS Server and Client

This tutorial shows how I mounted an NFS file system in my home network with two computers.

SERVER

1) Install nfs-kernel-server package:

$ sudo apt-get install nfs-kernel-server

2) Create the export file system where the the NFS file system will be mounted to. In my case, the Storage directory:

$ sudo mkdir -p /export/Storage

3) I want to mount my external hard drive at /media/LACIE. To do that we enter:

$ sudo mount --bind /media/LACIE /export/Storage

4) If everything works out fine you should be able to access your files through the directory /exports/Storage. To make sure this will work at startup add the following line to the /etc/fstab file:

$ /media/LACIE /export/Storage none 0 0

5) In file /etc/default/nfs-kernel-server set:

NEED_SVCGSSD=no

6) In file /etc/default/nfs-common set:

NEED_IDMAPD=yes
NEED_GSSD=no

7) To export the directory to the machine with IP 10.42.43.3 we add in the /etc/exports file:

/export 10.42.43.3(rw,fsid=0,insecure,no_subtree_check,async)
/export/Storage 10.42.43.3(rw,nohide,insecure,no_subtree_check,async)

8) Now restart the service:

$ sudo service nfs-kernel-server restart


CLIENT

1) Install packages:

$ sudo apt-get install nfs-common

2) Mount the file system on the desired directory. In the command line below the IP 10.42.43.1 is the address of the server.

sudo mount -vt nfs4 -o proto=tcp,port=2049 10.42.43.1:/Storage /home/gbezerra/Storage

3) Finally, to make sure it works on boot add the following line to /etc/fstab:

10.42.43.1:/Storage /home/gbezerra/Storage nfs4 _netdev,auto 0 0


The reference I used was:

No comments:

Post a Comment