Mount the directory of another Linux server to the local machine through the mount command

Instructions:
The purpose of this operation is to mount the /backup directory of another machine (192.168.1.100) to the new directory /back of this machine

1. Start the NFS service on the machine where the directory is mounted and edit the /etc/exports file

1.1 Check whether nfs is installed
--查看知道已安装
# rpm -qa |grep nfs  
nfs-utils-1.3.0-0.61.el7.x86_64
libnfsidmap-0.25-19.el7.x86_64

If it is not installed, you can execute the following command to install it

# yum -y install nfs*
1.2 Start NFS service

Run the following command to check whether the nfs service is enabled

--若有该进程即为开启状态
# ps -aux|grep -v grep|grep nfs

or

--若有Active: active (exited) 字样则为开启状态
#service nfs status

If the nfs service is not enabled, execute the following command to enable it.

# service nfs start 
1.3 Edit the /etc/exports file
# vi /etc/exports 
 加入如下内容:
/backup    *(rw,sync,no_root_squash)
/back  *(insecure,rw,sync,no_root_squash)

2. Operation on this machine

# cd /
# mkdir back
# chmod 777 -R /back
# yum -y install nfs*
# rpm -qa |grep nfs
libnfsidmap-0.25-19.el7.x86_64
nfs-utils-1.3.0-0.65.0.1.el7.x86_64
nfsometer-1.7-1.el7.noarch
nfstest-2.1.5-1.el7.noarch
nfs4-acl-tools-0.3.3-20.el7.x86_64
# mount 192.168.1.100:/backup /back

Set up automatic mounting at startup

# vi /etc/rc.local
在后面添加如下内容:
# mount 192.168.1.100:/backup /back

The above is the content of this article. I hope this article can help you.

Guess you like

Origin blog.csdn.net/Ruishine/article/details/134777501