Monday, January 12, 2009

How to setup NFS Configuration files (/etc/exports)?

An entry in /etc/exports will typically look like this:

directory host1(option1,option2) host2(option3,option4)

Where,

directory - the directory or file system you want to share

host1, host2 - Allowed hosts to mount your shared folder. Using IP Address is better idea rather than host name. If the hosts are in your local network, mention their private IP address.

optionXX

ro: The directory is shared read only; the client machine will not be able to write it. 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. (Exactly which UID the request is mapped to depends on the UID of user "nobody" on the server, not the client.) 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. You should not specify this option without a good reason.

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 - that is, has 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.


Related Topic - How to setup Network File System (NFS)?

No comments: