User Tools

Site Tools


documentation:setup_and_user_guide:nfs_clients

NAS4free - NFS Client Configuration

Introduction

NFS (Network File System) allows you to 'share' a directory located on one networked computer with other computers/devices on that network. The computer 'sharing' the directory is called the server, and the computers or devices connecting to that server are called clients. The clients 'mount' the shared directory, and the shared directory becomes part of their own directory structure.

NFS is perfect for a NAS (Networked Attached Storage) deployment in a Linux/Unix environment. It is a native Linux/Unix protocol as opposed to Samba which uses the CIFS/SMB protocol developed by Microsoft. The Apple OS has good support for NFS. Windows 7 has some support for NFS.

NFS is perhaps best for more 'permanent' network mounted directories such as /home directories or regularly accessed shared resources. If you want a network share that guest users can easily connect to, Samba is more suited. This is because tools exist more readily across operating systems to temporarily mount and detach from Samba shares.

Before deploying NFS you should be familiar with:

  • Linux file and directory permissions
  • Mounting and detaching (unmounting) filesystems

Open a Terminal (Console) and understand these commands:

  • man mount
  • man umount
  • man chown
  • man chmod

INSTALL NAS4free if it isn't already installed.

SERVER Configuration

Enable NFS, then select “Save and Restart”. See – SUG Section 6.5-NFS.

Configure the Shares. See – SUG Section 6.5.1-Services NFS Shares.

Verify Connection to Server

Connect your Client to the Network, and use PING to verify that you can reach the Server's IP Address. You can also try to open the NAS4free WebGUI, if you are successful then you have a working connection.

CLIENT Installation & Configuration

CLIENT Required Software Install:

For Ubuntu you will need to install these packages to mount NFS shares:

sudo apt-get install nfs-common portmap

When configuring portmap DO NOT bind loopback. If you do, you can either edit /etc/default/portmap by hand or run:

sudo dpkg-reconfigure portmap
sudo /etc/init.d/portmap restart

CREATE DIRECTORY to MOUNT NFS Shares on CLIENT:

cd /
cd /mnt
sudo mkdir nas4free
ls -alt

MOUNT your NFS shares:

# EXAMPLE: sudo mount Your_IP_Address:/path/to/share /path/on/client
sudo mount 192.168.1.250:/mnt/mysata /mnt/nas4free
 
 
# EXAMPLE: sudo mount server.mydomain.com:/files to /files
sudo mount NAS4free:/mnt/files /mnt/files

To have it auto mount on the Client on each bootup:

sudo nano /etc/fstab

Then, at the end of that file, put in the following:

192.168.1.250:/mnt/Share /mnt/nas4free nfs auto,defaults 0 0

You may have to restart the services to see the mount:

sudo /etc/init.d/portmap restart
sudo /etc/init.d/nfs-common restart

If you have a firewall you need to make sure ports 32771, 111 and 2049 are open.

When finished – UMOUNT your NFS Shares, and disconnect from the Server:

Install NFS Server Support in Ubuntu 10.04

sudo apt-get install nfs-kernel-server nfs-common portmap

When configuring portmap do =NOT= bind loopback. If you do you can either edit /etc/default/portmap by hand or run:

sudo dpkg-reconfigure portmap
sudo /etc/init.d/portmap restart

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

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 192.168.1.1 through 192.168.1.255:

/files 192.168.1.0/24(rw,no_root_squash,async)

Or for Read Only from a single machine:

/files 192.168.1.2 (ro,async)

save this file and then in a terminal type:

sudo exportfs -a
sudo /etc/init.d/nfs-kernel-server restart
sudo /etc/init.d/nfs-common restart

Mounting at boot using /etc/fstab: Invoke the text editor using your favorite editor, or execute the following in a terminal:

gksudo gedit /etc/fstab

In this example my /etc/fstab was like this:

server.mydomain.com:/files /files nfs rsize=8192,wsize=8192,timeo=14,intr

You could copy and paste my line, and change “servername.mydomain.com:/files”, and “/files” to match your server name:share name, and the name of the mount point you created.

Warning - It is a good idea to test this before a reboot in case a mistake was made. Type the following in a terminal, and the mount point /files will be mounted from the server:
mount /files

For more in-depth information about NFS you can read the TLPD NFS How To.

documentation/setup_and_user_guide/nfs_clients.txt · Last modified: 2018/07/08 16:57 (external edit)