The concept nfs is the short name of the network file system, which is an integral part of distributed computer systems and can be used to share and assemble 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. NFS network topology under ideal conditions 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 to achieve file directory sharing between two Linux systems, 3, NFS for the C/s architecture; . Server configuration 1, configuration file The main configuration file is:/etc/exports format: Shared directory can mount host IP (parameter 1, parameter 2, ...) such as:/var/nfs 172.20.*.* (rw,sync,no_rootl_squash) Description: Must pay attention to nfs/directory access rights, must be set to 777 permissions, parent directory/var permission is not required, ordinary 755 can be;  2, start related services then start related services in turn: Portmap,nfslock,nfs service portmap start service nfslock start Service NFS start off in reverse order.   3, check shared directory then take a look at the showmount–e to see the shared directory: [[email protected] var]# showmount-e Export list for Ns.osserver: /var/nfs 172.20.*.* ok, End of NFS server Setup; Client configuration 1, ensure Portmap run The client must ensure that the RPC protocol phaseThe Portmap should run normally, 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 successful mount, you can operate the same as the local directory; . Other related commands 1, when the/etc/exports file is modified, it is possible to use the NFS service directly without restarting the EXPORTS–RV To re-export the shared directory; the command format is as follows: exportfs [-aruv] -a: All mount or unmount/etc/exports content -r: Re-mount/etc/ Exports directory -u:umount directory -v: When exporting, export detailed information to the screen. Specific example: [[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 a great help for NFS operation and error checking, so let's take a look at Showmount's usage showmout  -A: This parameter is typically used on NFS server and is used to display the Cline machine that has already been mount on the native NFS directory.  -E: Displays the export directory on the specified NFS server. 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/share172.20.16.137:*172.20.16.137:,172.20.*.* 172.20.16.137:,172.20.16.*172.20.16.137:/root/share172.20.16.139:*172.20.16.139:,172.20.*.*172.20.16.139:, 172.20.16.*172.20.16.139:,172.20.16.139172.20.16.139:default FAQ 1, tips: Mount to NFS server ' 172.20.67.203 ' Failed:server is down. solution: There may be a problem with the firewall for Server for NFS;  2, hint: mount:RPC:Timed out Solution: Because the RPC protocol is not running, starting the Portmap service; may also be a firewall problem; server/client is possible.
Linux NFS file sharing