NFS configuration in Linux-Linux Enterprise Application-Linux server application information. For details, refer to the following section. Environment:
Client: Host rac2, ip 192.168.0.6
Server: Host rac1, ip 192.168.0.5
1) when the portmap and nfs services are started on the client, the nfs process cannot be started.
Check whether the nfs process is running normally.
[Root @ rac2 init. d] # ps-ef | grep nfs
Root 3222 1 0? 00:00:00 [nfsd]
Root 3223 1 0? 00:00:00 [nfsd]
Root 3224 1 0? 00:00:00 [nfsd]
Root 3225 1 0? 00:00:00 [nfsd]
Root 3226 1 0? 00:00:00 [nfsd]
Root 3227 1 0? 00:00:00 [nfsd]
Root 3228 1 0? 00:00:00 [nfsd]
Root 3231 1 0? 00:00:00 [nfsd]
Root 3260 2998 0 00:00:00 pts/0 grep nfs
There is a/disk0 partition on rac1 to see if rac1 can be directly connected from rac2.
[Root @ rac1 ~] # Df-h
Filesystem Size Used Avail Use % Mounted on
/Dev/sda5 2.9G 2.3G 503 M 83%/
/Dev/sda1 99 M 12 M 83 M 12%/boot
None 125 M 0 125 M 0%/dev/shm
/Dev/sda2 7.7G 2.3G 5.1G 32%/home
/Dev/sda3 3.9G 2.3 GB 1.4G 62%/usr
/Dev/sda7 2.8G 1.1G 1.6G 40%/var
/Dev/sdb5 1004 M 1.3 M 952 M 1%/disk0
[Root @ rac2 init. d] # mount 192.168.0.5:/disk0/wyl (/wyl directory must already exist)
Mount: mount to NFS server '192. 168.0.5 'failed: System Error: Connection refused.
The error message indicates that the nfs process on the server (Rac1) is unavailable!
Start the nfs process on the server (in fact, the portmap and nfs processes must be started)
[Root @ rac1 ~] #/Etc/init. d/portmap start
Starting portmap: [OK]
[Root @ rac1 ~] #/Etc/init. d/nfs start
Starting NFS services: [OK]
Starting NFS quotas: [OK]
Starting NFS daemon: [OK]
Starting NFS mountd: [OK]
Starting RPC idmapd: [OK]
Connect to the client again
[Root @ rac2 init. d] # mount 192.168.0.5:/disk0/wyl
Mount: 192.168.0.5:/disk0 failed, reason given by server: Permission denied
This error message is reported because the client is not authorized to connect to the server. In fact, the principle is very simple. The server must decide which IP addresses can be mounted and which partition can be mounted.
Edit the/etc/wxports file on the server
[Root @ rac1 ~] # Vi/etc/exports
/Disk0 192.168.0.6 (rw)
The first column defines which partition on the server can be mounted, and the second column defines which client IP addresses can be mounted.
Note that after modifying/etc/export, restart the nfs process.
Vi/etc/exports
/Disk0 192.168.0.6 (rw)
~
~
~
"/Etc/exports" 1L, 24C written
[Root @ rac1 ~] # More/etc/exports
/Disk0 192.168.0.6 (rw)
[Root @ rac1 ~] #/Etc/init. d/nfs restart
Shutting down NFS mountd: [OK]
Shutting down NFS daemon: [OK]
Shutting down NFS quotas: [OK]
Shutting down NFS services: [OK]
Starting NFS services: [OK]
Starting NFS quotas: [OK]
Starting NFS daemon: [OK]
Starting NFS mountd: [OK]
Now you can connect to the client.
[Root @ rac2 init. d] # mount 192.168.0.5:/disk0/wyl
No error message is reported.
[Root @ rac2 init. d] # df-h
Filesystem Size Used Avail Use % Mounted on
/Dev/sda5 2.9G 277 M 2.5G 10%/
/Dev/sda1 99 M 12 M 83 M 12%/boot
None 125 M 0 125 M 0%/dev/shm
/Dev/sda2 7.7G 62 M 7.3G 1%/home
/Dev/sda3 3.9G 2.5 GB 1.2G 68%/usr
/Dev/sda7 2.8G 117 M 2.5G 5%/var
192.168.0.5:/disk0 1004 M 1.3 M 952 M 1%/wyl
To enable the system to automatically start the portmap and nfs processes at the next restart, execute these commands on both the client and server.
# Chkconfig? Level 235 portmap on
# Chkconfig? Level 235 nfs on
To automatically connect to the nfs partition of the server when the client restarts next time, modify the/etc/fstab file of the client. Add
/Wyl 192.168.0.5:/disk0
Summarize the configuration process:
1) Start portmap and nfs on both the client and server, preferably to automatically start the process.
2) modify the/etc/exports file on the server and define the client to be connected.
3) Client Connection
Mount serverip: Directory Client Directory
4) edit the client/etc/fstab so that the client can connect to the server after each restart.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service