Operating System - Linux
1748180 Members
3888 Online
108759 Solutions
New Discussion юеВ

Re: export NFS File System

 
SOLVED
Go to solution
dsi.ts.sis
Occasional Advisor

export NFS File System

Hello

I need to export a file system in a Linux box and mount it with read annd write permission in 4 other Linux Web Servers but i don┬┤t know if this can be done and what would happen in case 2 machines tried to access and write into the File System at the same time, how NFS would manage this situation?

Thanx
3 REPLIES 3
Steven E. Protter
Exalted Contributor
Solution

Re: export NFS File System

Shalom,

Here is a sample /etc/exports file.

#
/share/centos/5/iso *(rw)
/share/video *(rw,no_root_squash)


There are other options such as host name limitations.

/exported/directory bob.example.com
# Limits exported directory access to host name bob.example.com

In the example, bob.example.com can mount /exported/directory/. Because no options are specified in this example, the following default NFS options take effect:

*

ro ├в Mounts of the exported file system are read-only. Remote hosts are not able to make changes to the data shared on the file system. To allow hosts to make changes to the file system, the read/write (rw) option must be specified.
*

wdelay ├в Causes the NFS server to delay writing to the disk if it suspects another write request is imminent. This can improve performance by reducing the number of times the disk must be accessed by separate write commands, reducing write overhead. The no_wdelay option turns off this feature, but is only available when using the sync option.
*

root_squash ├в Prevents root users connected remotely from having root privileges and assigns them the user ID for the user nfsnobody. This effectively "squashes" the power of the remote root user to the lowest local user, preventing unauthorized alteration of files on the remote server. Alternatively, the no_root_squash option turns off root squashing. To squash every remote user, including root, use the all_squash option. To specify the user and group IDs to use with remote users from a particular host, use the anonuid and anongid options, respectively. In this case, a special user account can be created for remote NFS users to share and specify (anonuid=,anongid=), where is the user ID number and is the group ID number.



From:
http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Deployment_Guide-en-US/s1-nfs-server-config-exports.html

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Matti_Kurkela
Honored Contributor

Re: export NFS File System

The answer depends on which version of the NFS protocol you're using and which mount options you've chosen.

NFS versions 2 and 3 will require you to run separate RPC lockd and statd services on both server and the clients to allow file locking. The locks in these NFS versions are advisory only. In general, file locking has been something of a weak point of NFSv2 and NFSv3. Only some file locking functions of the OS are supported by NFS, so the application must explicitly be programmed to expect that someone else may be accessing the files, and to use NFS-compatible file locking functions (fcntl() instead of flock()).

NFS version 4 allows mandatory locking, but it's significantly newer and less well known than the older versions. The application still must not assume it's the only one accessing its files, and it must request the correct types of locks based on what it is going to do.

NFSv4 also has more complex security features than the older versions of the protocol. Make sure you understand your NFSv4 configuration and test it carefully before using it in production systems.

MK
MK
dsi.ts.sis
Occasional Advisor

Re: export NFS File System

Thanks to you 2