NFS Server can share files. This feature is also added to other software services. So what is NFS? NFS was initially developed by Sun Microsytem in 1984. Its primary function is to allow UNIX computers on the network to share directories and files. we can mount the file system shared by the remote end to the local end, and then we can easily use the remote end file, the operations are just like local operations, so they won't feel any different. NFS also has many advantages, such as centralized file management and disk space saving ...... and so on.
Install NFS:
Most Linux Distribution will install NFS. In OpenLinux, NFS is composed of two RPM suites: NFS and nfs-server, nfs mainly includes some clients, while nfs server is mainly a daemon program of NFS Server.
Set NFS:
Configuration File:/etc/exports
File Format: File System [host] [Option]
Example:
/Charlie (ro) john (rw, no_root_squash)
/Tmp pc * .col.com.tw (rw) 172.29.0.0/255.255.255.0.0 (ro)
/Pub (ro)
/Pub/private (noaccess)
Option description:
Ro read only
Rw read write
No_root_squash: trust the client, corresponding to UID
Noaccess client is not available
Start and end NFS services:
After changing the configuration file, remember to restart the NFS service. The Start and Stop methods are as follows:
#/Etc/rc. d/init. d/nfs [start | stop | restart | reload]
Start NFS service
Stop NFS service
Restart stop and restart NFS service
Reload the NFS Setting Value
The client uses NFS:
1. View NFS services:
The client can use the showmount command to check which NFS services are provided by the Server.
# Showmount-e to see which directories are shared
# Showmount-a: All the mount entries are displayed.
2. Connect to the NFS Server:
To use resources on the NFS Server, use the mount command.
# Mount-tNFShostname:/shared_dir
Example:
# Mount-tNFS192.168.1.100:/tmp/mnt/nfs
3. automatically connect to NFS upon startup:
If you want to automatically mount NSF when starting the system, you need to edit the/etc/fstab file.
Example:
192.168.1.100:/tmp/mnt/nfsNFSdefaults 0 0