NFS Introduction
NFS is short for Network File System, that is, Network File System. the Network File System is one of the file systems supported by FreeBSD, also known as NFS. NFS allows a system to share directories and files with others on the network. By using NFS, users and programs can access files on the remote system just like accessing local files.
NFS benefits
The following are the most obvious advantages of NFS:
1. The local workstation uses less disk space because the data can be stored on a machine and accessed over the network.
2. You do not have to have a home directory in each machine on the network. The Home directory can be placed on the NFS server and is available everywhere on the network.
3. storage devices such as soft drive, CDROM, and Zip (a high storage density disk drive and disk) can be used by other machines on the network. This reduces the number of removable media devices on the network.
Linux Server 192.168.190.199 Server
Linux Server 192.168.190.208 Client
192.168.190.199 (server) configuration operation:
1. Install the service
Check whether nfs and portmap services are installed.
If nfs is not installed, portmap uses yum search <package name> to install the corresponding package.
2. Configure/etc/exports
Configure in the/etc/exports file
The configuration parameters are as follows:
[Shared directory] [host name 1 or IP1 (parameter 1, parameter 2)] [host name 2 or IP2 (parameter 3, parameter 4)]
Below are some common NFS sharing parameters:
Ro read-only access
Rw read/write access
Sync all data written for sharing upon request
Async NFS can request data before writing data
Secure NFS is sent through the secure TCP/IP ports below 1024
Insecure NFS is sent over port 1024
Wdelay if multiple users want to write data to the NFS Directory, group write (default)
No_wdelay if multiple users want to write data to the NFS Directory, write the data immediately. This setting is not required when async is used.
Hide does not share its subdirectories in the NFS shared directory.
No_hide shares the subdirectory of the NFS Directory
Subtree_check if sub-directories such as/usr/bin are shared, force NFS to check the permissions of the parent directory (default)
No_subtree_check is opposite to the above. The parent directory permission is not checked.
All_squash: The UID and GID of the shared file are mapped to the anonymous user anonymous, which is suitable for public directories.
No_all_squash retains the UID and GID of the shared file (default)
Root_squash all requests of the root user are mapped to the same permissions as those of the anonymous user (default)
The no_root_squas root user has full management access permissions to the root directory.
Anonuid = xxx specifies the UID of an anonymous user in the NFS server/etc/passwd file
Anongid = xxx specifies the GID of anonymous users in the NFS server/etc/passwd file
For example:
/Home/route 208 192.168.190.208 (rw, sync) * (ro) configuration Description: grant read and write permissions to 192.168.102.15. Other machines only have read-only permissions.
3. NFS service
Start NFS service
/Etc/init. d/portmap start
/Etc/init. d/nfs start
Stop NFS service
/Etc/init. d/nfs stop
/Etc/init. d/portmap stop
Restart the NFS service
/Etc/init. d/nfs restart
/Etc/init. d/portmap restart
Check the status of portmap and nfs services
/Etc/init. d/portmap status
/Etc/init. d/nfs status
Set automatic start of NFS service
For Linux systems in actual use, it is unrealistic to manually start the nfs service after each boot. You should set the system at the specified running level (usually 3 and 5) automatically Start the portmap and nfs services.
Chkconfig -- level 35 portmap on
Chkconfig -- level 35 nfs on
Run the "ntsysv" command to start the service configuration program. Find the "nfs" and "portmap" services, add "*" before them, and select "OK.
4. Configure the client on 192.168.190.208 (client)
Create a folder in the specified directory and mount the server folder
Mkdir-p/home/route 208
Mount 192.168.190.199:/home/secrets 208/home/secrets 208 (mounting)
5. Test mounting
192.168.190.208/home/2017208 create directory test
192.168.190.199/home/secrets 208 check that the test directory already exists.
The test is successful.
This article comes from "the past cannot be changed, but the future can be ."