‘NFS‘ stands for Network File System
‘NFS‘ is a file sharing protocol which is used in the GNU/Linux and unix network.
Advantages of NFS :
1. Local workstation can use less disk space.
2. No need of maintaining seprate Home directory on every network workstation.
3. Storage device like Floppy,CDROM and Zip drives can be shared throughout the network.
4. manage data storage from single point.
NFS Server Installation :
While installing NFS, check installation extra packages nfs-common and portmap.
if nfs-common and portmap is not installed, install nfs-common and portmap along with nfs-kernel-server.
————————————————————
root@nfs-server:~# apt-get install nfs-kernel-server
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
libevent1 libgssglue1 libnfsidmap2 librpcsecgss3 nfs-common portmap
The following NEW packages will be installed:
libevent1 libgssglue1 libnfsidmap2 librpcsecgss3 nfs-common nfs-kernel-server portmap
0 upgraded, 7 newly installed, 0 to remove and 8 not upgraded.
Need to get 493kB of archives.
After this operation, 1495kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://in.archive.ubuntu.com hardy/main libevent1 1.3e-1 [44.8kB]
Get:2 http://in.archive.ubuntu.com hardy/main libgssglue1 0.1-1 [20.4kB]
Get:3 http://in.archive.ubuntu.com hardy/main libnfsidmap2 0.20-0build1 [23.0kB]
Get:4 http://in.archive.ubuntu.com hardy-updates/main librpcsecgss3 0.17-1ubuntu2 [30.4kB]
Get:5 http://in.archive.ubuntu.com hardy/main portmap 6.0-4 [33.6kB]
Get:6 http://in.archive.ubuntu.com hardy-updates/main nfs-common 1:1.1.2-2ubuntu2.2 [190kB]
Get:7 http://in.archive.ubuntu.com hardy-updates/main nfs-kernel-server 1:1.1.2-2ubuntu2.2 [150kB]
Fetched 493kB in 14s (34.8kB/s)
Preconfiguring packages …
Selecting previously deselected package libevent1.
(Reading database … 134948 files and directories currently installed.)
Unpacking libevent1 (from …/libevent1_1.3e-1_i386.deb) …
Selecting previously deselected package libgssglue1.
Unpacking libgssglue1 (from …/libgssglue1_0.1-1_i386.deb) …
Selecting previously deselected package libnfsidmap2.
Unpacking libnfsidmap2 (from …/libnfsidmap2_0.20-0build1_i386.deb) …
Selecting previously deselected package librpcsecgss3.
Unpacking librpcsecgss3 (from …/librpcsecgss3_0.17-1ubuntu2_i386.deb) …
Selecting previously deselected package portmap.
Unpacking portmap (from …/portmap_6.0-4_i386.deb) …
Selecting previously deselected package nfs-common.
Unpacking nfs-common (from …/nfs-common_1%3a1.1.2-2ubuntu2.2_i386.deb) …
Selecting previously deselected package nfs-kernel-server.
Unpacking nfs-kernel-server (from …/nfs-kernel-server_1%3a1.1.2-2ubuntu2.2_i386.deb) …
Setting up libevent1 (1.3e-1) …
Setting up libgssglue1 (0.1-1) …
Setting up libnfsidmap2 (0.20-0build1) …
Setting up librpcsecgss3 (0.17-1ubuntu2) …
Setting up portmap (6.0-4) …
* Starting portmap daemon… [ OK ]
Setting up nfs-common (1:1.1.2-2ubuntu2.2) …
Creating config file /etc/idmapd.conf with new version
Creating config file /etc/default/nfs-common with new version
Adding system user `statd’ (UID 112) …
Adding new user `statd’ (UID 112) with group `nogroup’ …
Not creating home directory `/var/lib/nfs’.
* Starting NFS common utilities [ OK ]
Setting up nfs-kernel-server (1:1.1.2-2ubuntu2.2) …
Creating config file /etc/exports with new version
Creating config file /etc/default/nfs-kernel-server with new version
* Starting NFS common utilities [ OK ]
* Exporting directories for NFS kernel daemon… [ OK ]
* Starting NFS kernel daemon [ OK ]
Processing triggers for libc6 …
ldconfig deferred processing now taking place
root@nfs-server:~#
————————————————————
after installation you had to configure NFS.
NFS Configuration :
NFS export from the server is controlled by /etc/exports
open /etc/exports
————————————————————
root@nfs-server:~# vim /etc/exports
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes hostname1(rw,sync) hostname2(ro,sync)
#
# Example for NFSv4:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt)
# /srv/nfs4/homes gss/krb5i(rw,sync)
#
/home 192.168.1.2/24(rw,no_root_squash,sync)
————————————————————
Where /home is the path, 192.168.1.2 is the IP followed by kind of access option from the NFS server.
client can be specified either by name or IP address.
Wildcards (*) are allowed in names, as are netmasks (e.g. /24) following IP addresses ie., 192.168.1.2/24
Some important access options are:
* ro: The directory is shared read only. This is the default.
* rw: The client machine will have read and write access to the directory.
* no_root_squash: By default, any file request made by user root on the client machine is treated as if it is made by user nobody on the server, If no_root_squash is selected, then root on the client machine will have the same level of access to the files on the system as root on the server. This can have serious security implications, although it may be necessary if you want to perform any administrative work on the client machine that involves the exported directories.
* no_subtree_check: If only part of a volume is exported, a routine called subtree checking verifies that a file that is requested from the client is in the appropriate part of the volume. If the entire volume is exported, disabling this check will speed up transfers.
* sync: By default, all but the most recent version (version 1.11) of the exportfs command will use async behavior, telling a client machine that a file write is complete ie., been written to stable storage – when NFS has finished handing the write over to the filesystem. This behavior may cause data corruption if the server reboots, and the sync option prevents this.
after you save the /etc/exports file, you need to restart NFS server by
————————————————————
root@nfs-server:~# /etc/init.d/nfs-kernel-server restart
————————————————————
You can validate the exported filesystem
————————————————————
root@nfs-server:~# exportfs
/home 192.168.1.2/24
————————————————————
if you make any changes to /etc/exports on a running NFS server,you can make these changes effective by
————————————————————
root@nfs-server:~# exportfs -a
————————————————————
NFS Client Installation :
While installing NFS in client system,check intallation extra packages portmap.
if portmap is not installed, install portmap along with nfs-common.
————————————————————
verman@verman-desktop:~$ sudo apt-get install nfs-common
[sudo] password for verman:
Sorry, try again.
[sudo] password for verman:
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages will be upgraded:
nfs-common
1 upgraded, 0 newly installed, 0 to remove and 315 not upgraded.
Need to get 176kB of archives.
After unpacking 0B of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
nfs-common
Install these packages without verification [y/N]? y
Get:1 http://us.archive.ubuntu.com gutsy-updates/main nfs-common 1:1.1.1~git-20070709-3ubuntu1.1 [176kB]
Fetched 176kB in 3s (51.1kB/s)
(Reading database … 165628 files and directories currently installed.)
Preparing to replace nfs-common 1:1.1.1~git-20070709-3ubuntu1 (using …/nfs-common_1%3a1.1.1~git-20070709-3ubuntu1.1_i386.deb) …
Unpacking replacement nfs-common …
Setting up nfs-common (1:1.1.1~git-20070709-3ubuntu1.1) …
* Stopping NFS common utilities [ OK ]
* Starting NFS common utilities [ OK ]
————————————————————
Mounting manually:
Make a directory
————————————————————
verman@verman-desktop:~$ sudo mkdir /media/home
[sudo] password for verman:
————————————————————
mount the home directory
————————————————————
verman@verman-desktop:~$ sudo mount 192.168.1.2:/home /media/home
verman@verman-desktop:~$ cd /media/home
verman@verman-desktop:/media/home$ ls
a.out Documents Music Pictures Templates Videos
Desktop Examples Public test.c
verman@verman-desktop:/media/home$
————————————————————
using /etc/fstab we can mount ‘home’ at boot time :
————————————————————
verman@verman-desktop:~$ sudo vim /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# /dev/hdc2
UUID=e5416125-ba06-494f-bdcb-7ab0fecfc2d3 / ext3 defaults,errors=remount-ro 0 1
# /dev/hdc1
UUID=50CCC42BCCC40D62 /media/hdc1 ntfs defaults,umask=007,gid=46 0 1
# /dev/hdc4
UUID=6448-E683 /media/hdc4 vfat defaults,umask=007,gid=46 0 1
# /dev/hdc5
UUID=77835f55-5ca9-4db1-be82-a1b90b52f7fc none swap sw 0 0
/dev/hdd /media/cdrom0 udf,iso9660 user,noauto,exec 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec 0 0
# filesystem mountpoint fs-type options dump pass
192.168.1.2:/home /media/home nfs rw,hard,intr 0 0
verman@verman-desktop:~$
————————————————————
where ’192.168.1.2:/home’ is the path from filesystem, ‘/media/home’ is mount point and ‘nfs’ is filesystem type.
Options include two distinct failure modes:
soft :
If a file request fails, the NFS client will report an error to the process on the client machine requesting the file access.
hard :
Accessing a file on a NFS mounted file system will hang when the server crashes.The process cannot be interrupted or killed unless you specify ‘intr’. When the NFS server is back online the program will continue undisturbed from where it was. We recommend using hard,intr on all NFS mounted file systems.
* rw: The client machine will have read and write access to the directory.
Now home directory will be mounted every time you reboot the client system.
——————————————————————————————————-
*Note: Above installation has been tried in Ubuntu 8.04 and client Ubuntu 7.10, this above information will be more useful for GNU/Linux begineers.

from where do i get the packages nfs-common_1%3a1.1.2-2ubuntu2.2_amd64.deb before doing all the above task.
dipti.
Type ‘sudo apt-get install nfs-kernel-server’ from your terminal and rest taken care by ubuntu repository.
or
if you need to download then you can get it from hardy-updates ( http://packages.ubuntu.com/hardy-updates/amd64/nfs-common/download )
I am trying to install the network file system in ubuntu. I have types the command
apt-get install nfs-kernal-server
it starts reading the package lists and building dependency tree and reading state information and then all of the sudden it says
E: Couldn’t find package nfs-kernel-server
And I’m not sure what to do?! Any ideas? fyi…I don’t have connection to the internet through this server.
You can get full set of Ubuntu Repository DVDs (set of 5 DVDs) from Zyxware
follow this link : http://www.zyxware.com/articles/2008/07/20/ubuntu-repository-dvds-hardy-heron-8-04-available-at-zyxware
Get the DVD’s and follow the below link for adding Repositories in Ubuntu
https://help.ubuntu.com/community/Repositories/Ubuntu#Adding Repositories in Ubuntu
have have installed ubuntu 9.10 server but when i tried this
apt-get install nfs-kernel-server
or
sudo apt-get install nfs-kernel-server
i get error like this
reading package lists … done
building dependency tree
reading state information .. done
couldnt’ find package nfs-kernel-server
plz help how can i install nfs-kernel-server
first update
$sudo apt-get update
then install nfs-kernel-server nfs-common portmap
$sudo aptitude install nfs-kernel-server nfs-common portmap
that’s it.
msverman – Awesome dude! 1st instructions I tried that actually worked!