Article Title: Network File System NFS. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Concept of Network File System (NFS)
Network File System (NFS) is a way to share files between machines on the network, just as files are located on the customer's local hard drive. Red Hat Linux can be either an NFS server or an NFS client, which means that it can export the file system to another system or mount the file system imported from another machine.
NFS Installation
NFS is installed in RedHad by default. If NFS is not installed, manually install the following five rpm packages:
Setup-*: the shared NFS directory is defined in/etc/exports.
Initscripts-*: includes the BASIC script for loading the network directory during the boot process.
Nfs-utils-*: includes basic NFS commands and monitoring programs.
Portmap-*: supports secure connections to the nfs rpc service.
Quota-*: The Directory quota shared on the network, including rpc. rquotad (this package is not required)
NFS configuration (server configuration, operations performed on the host that needs to share the file system)
Edit the/etc/exports file to add a shared directory:
/Home/stb 192.168.1.235 (rw, sync, no_root_squash)
/Home/stb 192.168.1.170 (rw, sync, no_root_squash)
/Home/stb 192.168.1.31 (rw, sync, no_root_squash)
/Home/stb Is the shared directory;
192.168.1.235 is the IP address of the host (client) that needs to be mounted to the shared directory;
() Is opitons;
Rw: read/write permission;
Ro: Read-Only permission;
No_root_squash: if the user logging on to the NFS host is a ROOT user, the user has the ROOT permission. root_squash: if the user logging on to the NFS host is a root user, the user has the permission.
Sync: data is synchronized to the storage.
Async: The data is temporarily stored in the memory and not directly written to the hard disk.
Start NFS service
Service nfs start
Service nfs restart
Service nfs stop
Service nfs reload when the/etc/exports file is modified, you do not need to restart the service to execute this command.
Client mounting
Mount by using the mount command
Mount 192.168.1.162:/home/stb/mnt/stb
Mount-t nfs 192.168.1.162:/home/stb/mnt/stb-o nolock
// The client must have the/mnt/stb directory.