OmniSecu.com Logo  
omnisecu.com free mcse ccna rhce linux java learning
omnisecu.com free mcse ccna rhce linux java learning
          Sharefacebook twitter google+ google bookmark yahoo bookmark delicious digg linkedin pinterest reddit stumbleupon evernote diigo blinklist blogmarks livejournal email feed

Tutorials

How to mount a remote file system using Network File System (NFS)

External Resources

Network File System or NFS, is a server-client protocol for sharing files between computers on a common network. The NFS server exports one or more directories to the client systems, and the client systems mount one or more of the shared directories to local directories called mount points. After the share is mounted, all I/O operations are written back to the server, and all clients notice the change as if it occurred on the local filesystem. NFS uses RPC for communication.

Network File System (NFS) was originally developed by Sun Microsystems in the mid- 1980s. Linux has support for NFS (both as a client and a server).

Required Packages for Network File System (NFS)

NFS requires two main RPM packages: portmap and nfs-utils. These two packages are installed by default. If you want to confirm it, you can use rpm query command.

The nfs service script starts the following processes:

• rpc.mountd Handles mount requests

• nfsd Starts an nfsd kernel process for each shared directory

• rpc.rquotad Reports disk quota statistics to clients

If any of these processes is not running, NFS won't work. The status of these processes can be checked rpcinfo -p command.

Configuring Network File System(NFS)

1) First step in configuring NFS is to identify the directory, which you are going to export.

In this example, we will create a directory /nfs, and this directory will be exported using NFS.

[root@RHEL05 ~]# mkdir /nfs

2) The second step is to create an entry in /etc/exports file. The NFS configuration file is /etc/exports. Each line in this file lists the directory to be exported, the hosts to which it will be exported, and other options that apply to this export.

A line for an exported file system in /etc/exports has the following structure:

<export_directory> <host_ipaddr>(<export_options>)

Example:

/nfs 192.168.1.104(rw,no_root_squash)


The following methods can be used to specify host names:

• single host — Where one particular host is specified with a hostname, or IP address.

• wildcards - Common wildcards * or ? character is used to specify hosts. Example: *.omnisecu.com specifies all computers within the omnisecu.com domain. This also known as globbing.

• IP networks — Allows the matching of hosts based on their IP addresses within a larger network. Example: 192.168.1.0/24

• netgroups — Permits an NIS netgroup name.

Important export options

 Option

Explanation

secure

This  option  requires  that  requests  originate  on  an  internet port less than 1024.

insecure

 This supports NFS messages above ports 1024.

async

Replies to requests before the data is written to disk. This improves performance, but results in lost data if the server goes down.

sync

 Data is written upon request. Active by default.

rw 

Allow both read and write requests on this NFS volume.

ro

Allow read-only access.

no_wdelay

Data is written to the share immediately. This option has no effect if async is also set.

root_squash

Convert incoming requests from user root to the anonymous uid and gid.

no_root_squash

Remote root users get root privileges on the shared directory.

all_squash

All remote users are mapped as an anonymous user (nfsnobody, with a user id of 65534)

anonuid=userid

Allows you to map remote users to a specific user ID such as pcguest.

anongid=groupid

Allows you to map remote groups to a specific group ID such as pcguest.

3) Start the service using ‘service nfs start’ command.

To list the exports, we can use ‘exportfs –v’ command.

4) Mount the filesystem from a remote computer using the mount command as shown below.

[root@RHEL04 ~]# mount -t nfs 192.168.1.105:/nfs /nfs

5) After mounting, you can use the remote filesystem locally and once the work is completed, the remote filesystem should be unmounted by using ‘umount’ command.

              Jajish Thomason Google+
Related Topics

No Related Topics Available

comments powered by Disqus


eXTReMe Tracker DMCA.com