Build NFS in Linux and share it with AIX
I. Introduction to NFS
NFS is short for Network FileSystem, which is a Network file system. An agreement for the use of distributed file systems, developed by Sun, was published on April 9, 1984. The function is to allow different machines and operating systems to share individual data with each other through the network, so that applications can access data on server disks through the network on the client, it is a way to share disk files between Unix-like systems.
The basic principle of NFS is "allow different clients and servers to share the same file system through a group of RPC", which is independent of the operating system, allows different hardware and operating system systems to share files.
NFS depends on the RPC protocol during file transfer or information transfer. Remote Procedure Call (RPC) is a mechanism that enables the client to execute programs in other systems. NFS itself does not provide information transmission protocols and functions, but NFS allows us to share data over the network, because NFS uses some other transmission protocols. These transmission protocols use this RPC function. NFS itself is a program that uses RPC. Or NFS is also an rpc server. Therefore, the RPC service must be started wherever NFS is used, whether it is an nfs server or an nfs client. In this way, the SERVER and CLIENT can implement the corresponding program port through RPC. We can understand the relationship between RPC and NFS in this way: NFS is a file system, while RPC is responsible for information transmission.
Ii. NFS Process
Nfsd: it is a basic NFS Daemon. Its main function is to manage whether the client can log on to the server;
Mountd: it is the RPC installation daemon. Its main function is to manage NFS file systems. After the client successfully logs on to the NFS server through nfsd, it must pass the File Permission verification before using the files provided by the NFS service. It reads the NFS configuration file/etc/exports to compare the client permissions.
Portmap/rpcbind: Mainly used for port ing. When the client tries to connect to and use the services provided by the RPC server (such as the NFS service), portmap will provide the managed port corresponding to the service to the client, this allows the customer to request services from the server through this port.
3. Install NFS
Rpm-qa | grep nfs
Rpm-qa | grep rpcbind
In CentOS, the original portmap is changed to rpcbind. If the two software are not installed, You need to download the corresponding rpm package for installation (of course, you can also use other installation methods such as yum)
4. Start NFS1. view port configuration
By default, nfs communicates over port 2049, and portmap or rpcbind communicates over port 111.
Cat/etc/services | grep nfs
Nfs 2049/tcp nfsd shilp # Network File System
Nfs 2049/udp nfsd shilp # Network File System
Nfs 2049/sctp nfsd shilp # Network File System
Cat/etc/services | grep rpcbind
Sunrpc 111/tcp portmapper rpcbind # RPC 4.0 portmapper TCP
Sunrpc 111/udp portmapper rpcbind # RPC 4.0 portmapper
In addition, set the port number of the mount service to 976.
Cat>/etc/services
Mountd 976/udp
Mountd 976/tcp
Servicenfs restart
2. enable the network and Firewall
Set the IP addresses of the source and target machines and the preceding ports. Disable firewall shielding for these ports.
3. Configure export
Vim/etc/exports
/Home/bapogg 10.249.20./ 24 (rw, no_root_squash, async)
4. Start nfs
Servicenfs start
Servicerpcbind start
Servicenfs status
Rpc. svcgssd isstopped
Rpc. mountd (pid8451) is running...
Nfsd (pid 84488447 8446 8445 8444 8443 8442 8441) is running...
Rpc. rquotad (pid8435) is running...
Servicerpcbind status
Rpcbind (pid 1541) is running...
5. view the transmission performance through NFS 1. manual mode
By copying a large file, you can see how long it takes to complete the copy. Size/time = rate.
6. Mount NFS1. on the AIX Client
Stopsrc-g nfs
0513-044 The biodSubsystem was requested to stop.
0513-044 The nfsdSubsystem was requested to stop.
0513-044 Therpc. lockd Subsystem was requested to stop.
0513-044 Therpc. statd Subsystem was requested to stop.
Stopsrc-s portmap
0513-044 Theportmap Subsystem was requested to stop.
Startsrc-s portmap
0513-059 Theportmap Subsystem has been started. Subsystem PID is 156104.
Startsrc-g nfs
0513-059 The biodSubsystem has been started. Subsystem PID is 397708.
0513-059 The nfsdSubsystem has been started. Subsystem PID is 352796.
0513-059 Therpc. mountd Subsystem has been started. Subsystem PID is 360828.
0513-059 Thenfsrgyd Subsystem has been started. Subsystem PID is 369402.
0513-059 The gssdSubsystem has been started. Subsystem PID is 360830.
0513-059 Therpc. lockd Subsystem has been started. Subsystem PID is 369404.
Mount 10.249.60.65:/home/bapogg/ogg/test_nfs
Mount on a Linux Client
You also need to make some necessary settings for the client, which is skipped here.
Mount-t nfs 10.249.60.65:/home/bapogg/ogg/test_nfs
7. Uninstall 1. Uninstall on the AIX Client
Unmount/ogg/test_nfs
If this type of error is reported: umount: 1831-01516 error while unmounting 10.249.60.65:/home/bapogg-The requested resource isbusy.
Use fuser-k/ogg/test_nfs to kill the processes in use. Of course, fuser, ogg, and test_nfs are not so rude.