NFS Network File System mount Setup between Linux Systems NFS allows a system to share directories and files with others on the network, and by using NFS, users and programs can access files on the remote system as if they were accessing local files. Here are the setup methods for mounting the NFS network file system between Linux systems
Introduction to NFS
NFS is a shorthand for the network file system, which is the web filesystem. 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 as if they were accessing local files.
NFS Benefits
The following are the most obvious benefits of NFS:
1. The local workstation uses less disk space because the usual data can be stored on a single machine and can be accessed over the network.
2. The user does not have to have a home directory in the machine on each network. The home directory can be placed on an NFS server and is available everywhere on the network.
3. Storage devices such as floppy drives, CDROM, and Zip (refers to a high storage density disk drive and disk) can be used by other machines on the network. This can reduce the number of removable media devices across the network.
Linux Server 192.168.190.199 Service side
Linux Server 192.168.190.208 Client
192.168.190.199 (server side) configuration operation:
1. Installation Services
Check to see if installing the Nfs,portmap service
If NFS is not installed, Portmap use Yum Search < package name > install the appropriate package
2. Configure/etc/exports
Configuring in the/etc/exports file
The configuration parameters are as follows
[Shared directory] [Hostname 1 or IP1 (parameter 1, parameter 2)] [Hostname 2 or IP2 (parameter 3, parameter 4)]
Here are some common parameters for NFS sharing:
RO read-only access
RW Read-Write access
Sync all data is written to share on request
Async NFS can request the data before writing it
Secure NFS is sent over a secured TCP/IP port below 1024
Insecure NFS is sent over 1024 ports
Wdelay If multiple users are writing to the NFS directory, the group is written to (default)
No_wdelay if more than one user wants to write to the NFS directory, it is written immediately and does not require this setting when using Async.
Hide does not share its subdirectories in the NFS shared directory
No_hide subdirectories for shared NFS directories
Subtree_check if you share a subdirectory such as/usr/bin, Force NFS to check the permissions of the parent directory (default)
No_subtree_check and above, do not check parent directory permissions
All_squash shared file UID and GID mapping anonymous user anonymous, suitable for common directories.
No_all_squash preserve the UID and GID of shared files (default)
Root_squash all requests from the root user are mapped to the same permissions as the anonymous user (default)
No_root_squas Root user has full administrative access to the root directory
Anonuid=xxx specifying the UID of an anonymous user in an NFS server/etc/passwd file
Anongid=xxx specify GID for anonymous users in NFS server/etc/passwd files
Such as:
Copy CodeThe code is as follows:
/home/share208 192.168.190.208 (rw,sync) * (RO) Configuration instructions: give read and Write permissions to the 192.168.102.15, other machines have read-only permissions.
3. Services for NFS
Start the NFS service
Copy CodeThe code is as follows:
/etc/init.d/portmap start
/etc/init.d/nfs start
Stop the NFS service
Copy CodeThe code is as follows:
/etc/init.d/nfs stop
/etc/init.d/portmap stop
Restarting the NFS service
Copy CodeThe code is as follows:
/etc/init.d/nfs restart
/etc/init.d/portmap restart
Check the status of Portmap and NFS services
Copy CodeThe code is as follows:
/etc/init.d/portmap status
/etc/init.d/nfs status
Set up automatic start of NFS service
For Linux systems in practice, it is unrealistic to manually start the NFS service after each boot, and the system should be set to automatically start the Portmap and NFS services at the specified RunLevel (typically 3 and 5).
Copy CodeThe code is as follows:
Chkconfig–level Portmap on
Chkconfig–level NFS On
Execute the "NTSYSV" command to start the Service Configurator, locate the "NFS" and "portmap" services, precede them with "*", and then choose OK.
4.192.168.190.208 (customer service side) Configure the client
Create a folder in the specified directory to mount the server-side folder
Copy CodeThe code is as follows:
mkdir–p/home/share208
Mount 192.168.190.199:/home/share208/home/share208 (Mount)
5. Test Mounts
Copy CodeThe code is as follows:
192.168.190.208/home/share208 Creating a Catalog test
192.168.190.199/home/share208 view already has test directory
The test was successful.
Installation method for NFS network File system mount between Linux systems