Introduction to NFS
NFS is the shorthand for network file system, which is the network filesystem. The network file system is one of the FreeBSD supported file systems, 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 they would access 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. Users do not have to have a home directory in the machine on each network. The home directory can be placed on an NFS server and available everywhere on the network.
3. Storage devices such as floppy drive, 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 on the entire network.
Linux Server 192.168.190.199 Service side
Linux Server 192.168.190.208 Client
192.168.190.199 (server-side) configuration actions:
1. Installation Services
Check to see if installation Nfs,portmap service
If NFS is not installed, Portmap use Yum Search < package name > install the appropriate package
2. Configure/etc/exports
Configuring in/etc/exports Files
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)]
Here are some common parameters for NFS sharing:
RO read-only access
RW Read-Write access
Sync all data is written to share when requested
Async NFS can request it before writing data
Secure NFS is sent via a secure TCP/IP port under 1024
Insecure NFS is sent over 1024 ports
Wdelay If multiple users are writing to the NFS directory, group write (default)
No_wdelay If multiple users are writing to the NFS directory, write now and do not need this setting when using Async.
Hide does not share subdirectories in NFS shared directories
No_hide Share subdirectories for NFS directories
Subtree_check Force NFS to check the permissions of the parent directory (default) if you share a subdirectory such as/usr/bin
No_subtree_check and above, do not check parent directory permissions
All_squash the UID and GID of shared files map anonymous users anonymous, which is suitable for public directories.
No_all_squash preserves UID and GID for shared files (default)
Root_squash all requests for root users are mapped to the same permissions as anonymous users (default)
No_root_squas Root user has full administrative access to the root directory
Anonuid=xxx Specify the UID of anonymous users in server/etc/passwd files for NFS
Anongid=xxx Specify the GID for anonymous users in server/etc/passwd files for NFS
Such as:
Copy Code code as follows:
/home/share208 192.168.190.208 (rw,sync) * (RO) Configuration instructions: read-write access to 192.168.102.15, other machines have read-only access.
3. Services for NFS
Start the NFS service
Copy Code code as follows:
/etc/init.d/portmap start
/etc/init.d/nfs start
Stop NFS Services
Copy Code code as follows:
/etc/init.d/nfs stop
/etc/init.d/portmap stop
Restarting the NFS service
Copy Code code as follows:
/etc/init.d/nfs restart
/etc/init.d/portmap restart
Check the status of Portmap and NFS services
Copy Code code as follows:
/etc/init.d/portmap status
/etc/init.d/nfs status
To set up an NFS service to start automatically
For Linux systems in practice, it is not realistic to start the NFS service manually after each boot, and you should set up the system to automatically start Portmap and NFS services at the specified run level (typically 3 and 5).
Copy Code code as follows:
Chkconfig–level Portmap on
Chkconfig–level NFS On
Execute the "NTSYSV" command to start the service configuration program, locate the "NFS" and "portmap" services, precede them with "*" and select "OK".
4.192.168.190.208 (customer side) configuration client
Create a folder Mount server folder under a specified directory
Copy Code code as follows:
mkdir–p/home/share208
Mount 192.168.190.199:/home/share208/home/share208 (mounted)
5. Test Mount
Copy Code code as follows:
192.168.190.208/HOME/SHARE208 Create directory Test
192.168.190.199/home/share208 View already has the test directory
The test was successful.