NFS (Network File System)

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 21
At a glance
Powered by AI
NFS (Network File System) allows sharing of directories across networked computers. The computer sharing the directory is called the server, and computers connecting to it are called clients. Clients can mount the shared directory, making it part of their own file structure.

An NFS server exports directories to clients and requires packages like nfs-kernel-server. It uses configuration files like /etc/exports to define exported filesystems and their access permissions.

An NFS client installs packages like nfs-common and can mount the exported directories from the server, either manually or by adding entries to /etc/fstab for automatic mounting on boot.

NFS (Network File System)

First commercially successful network file system:


Developed by Sun Microsystems for their diskless workstations Designed for robustness and adequate performance Sun published all protocol specifications Many implementations

NFS (Network File System)


Uses the Sun RPC mechanism and Sun eXternal Data Representation (XDR) standard Defined as a set of remote procedures Protocol is stateless
Each procedure call contains all the information necessary to complete the call Server maintains no between call information

NFS (Network File System)


Crash recovery is very easy:
When a server crashes, client just resends request until it gets an answer from the rebooted server Client cannot tell difference between a server that has crashed and recovered and a slow server

Client can always repeat any request

NFS (Network File System)


Allows you to 'share' a directory located on one networked computer with other computers on that network.
The computer 'sharing' the directory is called the server and the computers connecting to that server are called clients.

NFS (Network File System)


The clients 'mount' the shared directory, it becomes part of their own directory structure. NFS is perfect for a NAS (Networked Attached Storage) deployment in a Linux environment.

NFS (Network File System)


The Apple OS has good support for NFS. Windows 7 has some support for NFS. Generally Windows use Samba (SMB) for file sharing of Linux NAS appliances or devices.

NFS (Network File System)


The Apple OS has good support for NFS. Windows 7 has some support for NFS. Generally Windows use Samba (SMB) for file sharing of Linux NAS appliances or devices.

NFS (Network File System)


NFS is perhaps best for more 'permanent' network mounted directories such as /home directories or regularly accessed shared resources.
A backup server can be setup using NFS, a backup script and crontab (scheduling)

NFS (Network File System)


Several servers can be scheduled to backup their applications and data files to a centralized backup server. This includes windows application servers that use Samba to backup. Backup server will write to hot swap drives that can be stored off site. Can be what you want to make it.

NFS (Network File System) NFSv4 server


Install the required packages...
# apt-get update # apt-get upgrade # apt-get install nfs-kernel-server

NFS (Network File System) NFSv4 server


Let's say we want to export our users' home directories in /home/users. First we create the export filesystem:
# mkdir -p /export/users Mount the real users directory with: # mount --bind /home/users /export/users

NFS (Network File System) v4 server


To save us from retyping this after every reboot we add the following line to /etc/fstab /home/users /export/users none bind 0 0

NFS (Network File System) v4 server


three configuration files that relate to an NFSv4 server: /etc/default/nfs-kernel-server /etc/default/nfs-common /etc/exports /etc/idmapd.conf

NFS (Network File System) v4 server


In /etc/default/nfs-kernel-server we set:

NEED_SVCGSSD=no # set to no because we are not activating NFSv4 security this time.

NFS (Network File System) v4 server


the /etc/idmapd.conf file
this file should have the following lines in the Mapping section: [Mapping] Nobody-User = nobody Nobody-Group = nogroup

NFS (Network File System) v4 server


the /etc/exports file
this file should have the following lines: /export 192.168.1.0/24(rw,fsid=0,insecure,no_subtree_check,as ync) /export/users 192.168.1.0/24(rw,nohide,insecure,no_subtree_check,a sync)

NFS (Network File System) v4 server


Now restart the service
# /etc/init.d/nfs-kernel-server restart

NFS (Network File System) v4 client


install the required packages...
# apt-get update # apt-get upgrade # apt-get install nfs-common

NFS (Network File System) v4 client


The client needs the same changes to connect to an NFSv4 server. In /etc/default/nfs-common we set:
NEED_IDMAPD=yes NEED_GSSD=no

NFS (Network File System) v4 client


On the client we can mount the complete export tree with one command: # mount -t nfs4 -o proto=tcp,port=2049 nfsserver:/users /home/users

NFS (Network File System) v4 client


On the client we can mount the complete export tree on boot by adding the following to the /etc/fstab:
nfs-server:/ /users /home/Users _netdev,auto 0 0

You might also like