Thursday, January 22, 2009

Setting up NFS server (Fedora core10) and client on FC6

NFS means Network File System. NFS allows a system to share directories and files with others over a network. By using NFS, users and programs can access files on remote systems almost as if they were local files.
Benefits of NFS:
*) Local workstations use less disk space because commonly used data can be stored on a single machine and still remain accessible to others over the network.
*) There is no need for users to have separate home directories on every network machine. Home directories could be set up on the NFS server and made available throughout the network.

How NFS Works?
NFS consists of at least two main parts: a server and one or more clients. The client remotely accesses the data that is stored on the server machine. In order for this to function properly a few processes have to be configured and running.
The server has to be running the following daemons: portmap or rpc.portmap, rpc.nfsd, rpc.lockd, rpc.statd, rpc.mountd, rpc.rquotad.

Configuring NFS Server
Through Gui: Redhat & Fedora distributions provide a GUI interface to setup NFS server.
Just type "system-config-nfs" on a terminal to invoke GUI setup. Then click "Add" Button at top left. Provide directory which you want to share and allowed hosts. In case if you don't want to restrict hosts, then type "*" in hosts field. Select permissions read-write/read-only and then click "ok".

Through command line:
Edit /etc/exports file. An entry in /etc/exports will typically look like this:
directory machine1(option11,option12) machine2(option21,option22)

Example: /opt *(rw,sync)

To make more robust, you can configure optional files /etc/hosts.allow and /etc/hosts.deny

After this make sure daemons portmapper, nfsd is running in your system ("rpcinfo -p" command will help you in this regard). Then run the command "exportfs -ra" to force nfsd to re-read the /etc/exports file.

For more details refer http://www.linux.org/docs/ldp/howto/NFS-HOWTO/server.html


Configuring NFS Client:

Mounting remote directories:
Make sure portmapper and optional rpc.statd, rpc.lockd daemons running on your system. With these daemons running, you should now be able to mount the remote directory from your server just the way you mount a local hard drive, with the mount command.For example
mount master.foo.com:/opt /mnt/opt or
mount -t nfs master.foo.com:/opt /mnt/opt

The standard form of the mount command, is
mount -t type device dir
where -t vfstype( file system types)

Windows mount: mount -t cifs //128.222.180.22/channel /mnt/envision -o username=,domain=corp

Getting NFS File systems to be mounted at boot time:
NFS file systems can be added to your /etc/fstab file the same way local file systems can, so that they mount when your system starts up. The only difference is that the file system type will be set to nfs and the dump and fsck order (the last two entries) will have to be set to zero. For example
cat /etc/fstab
# device mountpoint fs-type options dump fsckorder
10.31.251.75:/export/kits/envision /export/kits/envision nfs defaults 0 0

Then run "mount -a" command and also if require umount

Details: http://www.higs.net/85256C89006A03D2/web/PageLinuxNFSClientSetup. and also man mount

No comments: