Wednesday, 22 October 2008

HOWTO: NFS server

Install NFS Server Support
at the terminal type
sudo apt-get install nfs-kernel-server nfs-common portmap
(Optional: sudo dpkg-reconfigure portmap)
sudo /etc/init.d/portmap restart

Editing /etc/exports
the /etc/exports file is used for creating a share on the NFS server

invoke your favorite text editor or
sudo vi /etc/exports

Here are some quick examples of what you could add to your /etc/exports

For Full Read Write Permissions allowing any computer from through

  • /files,no_root_squash,async)
    Here /24 is netmask, meaning the netmask is 24 bits. Therefore, above line can be equivalent to:
  • /files (rw,no_root_squash,async)
    details can be found in the reference

Or for Read Only from a single machine
  • /files (ro,async)
save this file and then in a terminal type
sudo /etc/init.d/nfs-kernel-server restart

Also aftter making changes to /etc/exports in a terminal you must type
sudo exportfs -a

Install NFS client support
sudo apt-get install portmap nfs-common

Mounting manually
Example to mount to /files. In this example is the name of the server containing the nfs share, and files is the name of the share on the nfs server

The mount point /files must first exist on the client machine.
cd /
sudo mkdir files

to mount the share from a terminal type

sudo mount /files

Note you may need to restart above services:
sudo /etc/init.d/portmap restart
sudo /etc/init.d/nfs-common restart

Mounting at boot using /etc/fstab
Invoke the text editor using your favorite editor, or
gksudo gedit /etc/fstab

In this example my /etc/fstab was like this:
  • /files nfs rsize=8192,wsize=8192,timeo=14,intr
You could copy and paste my line, and change “”, and “/files” to match your server name:share name, and the name of the mount point you created.
It is a good idea to test this before a reboot in case a mistake was made.
mount /files
in a terminal, and the mount point /files will be mounted from the server.

========== (for client configuration) (for mounting using fstab) (for server configuration) (contains more info about NFS) (man for exports) (netmask /24 things)

No comments:

My photo
London, United Kingdom

Facebook & Twitter