First, the concept
NFS is the short name of the network file system and is an integral part of distributed computer systems that enable the sharing and assembly of remote file systems on heterogeneous networks.
NFS, developed by Sun, is now a standard for document Services (rfc1904,rfc1813). Its biggest function is to be able to use the network, so that different operating system computers can share data, so it can also be regarded as a file server. NFS is a way to communicate between Windows and Linux and Unix and Linux, in addition to samba.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/50/E4/wKiom1RizYuhtFXzAADSTr1OsOg887.jpg "title=" 1.JPG " alt= "Wkiom1rizyuhtfxzaadstr1osog887.jpg"/>
1. Set up file sharing between Linux systems (Linux and Windows intermediate file sharing using Samba services);
2, NFS is only a file system, itself does not have the transmission function, is based on the RPC protocol implementation, in order to achieve the two Linux system file directory sharing;
3, NFS for C/s architecture;
Second, the server configuration
1. Configuration files
The main configuration file is:/etc/exports
The format is: Shared directory can mount host IP (parameter 1, parameter 2, ...)
such as:/var/nfs 172.20.*.* (Rw,sync,no_rootl_squash)
Note: Must pay attention to the nfs/directory access permissions, must be set to 777 permissions, the parent directory/var permission is not required, ordinary 755 can be;
2. Start related services
Then start the related services in turn: Portmap,nfslock,nfs
Service Portmap Start
Service Nfslock Start
Service NFS Start
Turn off in reverse order.
3. Check the shared directory
You can then take a look at the showmount–e to see the shared directory situation:
[Email protected] var]# SHOWMOUNT-E
Export list for Ns.osserver:
/var/nfs 172.20.*.*
OK, so far, NFS server has been built;
Third, client configuration
1. Ensure Portmap operation
The client must ensure that the appropriate portmap of the RPC protocol is functioning properly, otherwise mount will fail;
2. Mount/var/nfs directory (local mount point is/mnt/nfs)
Mount-t NFS 172.20.65.16:/var/nfs/mnt/nfs
After the successful mount, the same as the local directory as arbitrary operation;
Iv. Other relevant orders
1, when the/etc/exports file is modified, you can re-export the shared directory without restarting the NFS service, directly using EXPORTS–RV;
The command format is as follows:
Exportfs [-aruv]
-A: All content in Mount or unmount/etc/exports
-R: Re-mount/etc/exports in the shared directory
-u:umount Directory
-V: In export, the detailed information is output to the screen.
Specific examples:
[Email protected] var]# SHOWMOUNT-E
Export list for Ns.osserver:
/var/nfs 172.20.*.*
[Email protected] var]# Exportfs–au #全部卸载
[Email protected] var]# SHOWMOUNT-E
Export list for Ns.osserver:
[[email protected] var]# EXPORTFS–RV #全部重新 Export Once
Exporting 172.20.*.*:/var/nfs
[Email protected] var]#
2. Showmout command is very helpful for NFS operation and error checking , so let's take a look at the usage of showmount.
Showmout
-A: This parameter is typically used on NFS server and is used to display the Cline machine that has been mount on the native NFS directory.
-E: Displays the directory that is export on the specified NFS server.
For example:
[Email protected] ~]# showmount-e 172.20.16.139
Export list for 172.20.16.139:
/root/share 172.20.16.137
[Email protected] var]# showmount-a
All mount points on Localhost.localdomain:
*:/root/share
, 172.20.*.*:/root/share
, 172.20.16.*:/root/share
, 172.20.16.139:/nfsshare
, 172.20.16.139:/root/share
172.20.16.137:*
172.20.16.137:,172.20.*.*
172.20.16.137:,172.20.16.*
172.20.16.137:/root/share
172.20.16.139:*
172.20.16.139:,172.20.*.*
172.20.16.139:,172.20.16.*
172.20.16.139:,172.20.16.139
172.20.16.139:default
Five, frequently asked questions
1. Hint:mount to NFS server ' 172.20.67.203 ' failed:server are down.
Solution: There may be a problem with the firewall for the NFS server;
2, Hint:mount:RPC:Timed out
Solution: Because the RPC protocol is not running; start the Portmap service;
There may also be a firewall problem; server/client is possible.
Linux NFS Introduction and related configuration