You are here
Home > Redhat > NFS configuration

NFS configuration

NFS

 

Package name : nfs
 

Service name : nfs, portmapper
 

port : 111, 2049
 

Editing the /etc/exports file is quite easy. Each line contains an export point and a whitespace-separated list of clients allowed to mount the file system at that point. Each listed client may be immediately followed by a parenthesized, comma-separated list of export options for that client. No whitespace is permitted between a client and its option list.
 

/export/this/directory (ro)
 

This shares the directory read-only to ALL hosts, including those on the Internet! You may also include a * immediately before (ro).
 

/export/this/directory 192.168.1.0/24(rw,async)
 

There is some widespread difficulty about automatically mounting NFS share at boot up. You MUST enable nfs daemon like this:
 

chkconfig nfs
 

If you see off, then you must:
 

chkconfig nfs on
 

Your /etc/fstab must include (at least):
 

remotehost:/path/to/export /local/mountpoint nfs auto 0 0
 

You can also include the following options:
 

auto,tcp,ro,intr
 

Secure Requires client requests to originate from a secure (privileged) port, that is, one numbered less than 1024
 

Insecure Permits client requests to originate from unprivileged ports (those numbered 1024 and higher)
 

Ro Exports the file system read-only, disabling any operation that changes the file system
 

Rw Exports the file system read-write, permitting operations that change the file system
 

Async Allows the server to cache disk writes to improve performance
 

Sync Forces the server to perform a disk write before the request is considered complete
 

Subtree_check If only part of a file system, such as a subdirectory, is exported, subtree checking makes sure that file requests apply to files in the exported portion of the file system
 

no_subtree_check Disables subtree_check
 

Wdelay Allows the server to delay a disk write if it believes another related disk write may be requested soon or if one is in progress, improving overall performance
 

no_wdelay Disables wdelay (must be used with the sync option)
 

root_squash Maps all requests from a UID or GID of 0 to the UID or GID, respectively, of the anonymous user (-2 in Red Hat Linux)
 

no_root_squash Disables root_squash
 

all_squash Maps all requests from all UIDs or GIDs to the UID or GID, respectively, of the anonymous user
 

no_all_squash Disables all_squash
 

Anonuid=uid Sets the UID of the anonymous account to uid
 

Anongid=gid Sets the GID of the anonymous account to gid
 

 

A bare exportfs call lists all currently exported file systems, and using -v lists currently exported file systems with their mount options.
 

# exporfs -v
 

/home 192.168.1.0(rw,async)
 

To mount from client:
 

# mount -t nfs ipaddress:/sharefolder /mnt
 

#cd /mnt
 

#ls

 

Leave a Reply

Top