在Linux中可以使用ntp挂载外部磁盘。
首先,确认下服务端系统是否已安装 NFS
$rpm -qa nfs-utils rpcbind
nfs-utils-1.3.0-0.54.el7.x86_64
rpcbind-0.2.0-38.el7.x86_64
注意:这里我已经安装完毕,若为空,则说明未安装。
安装NFS服务
# 服务端
$ yum install -y nfs-utils rpcbind
# 客户端
$ yum install -y nfs-utils
#启动服务
service rpcbind start
#或者使用如下命令
/bin/systemctl start rpcbind.service
查看 NFS 服务项 rpc 服务器注册的端口列表
rpcinfo -p localhost
配置NFS
vim /etc/exports
# 添加如下内容
# *表示全部网段,rw = 读写, sync= 实时同步
/nfs/gerrit_git/ *(rw,sync)
#保存退出
#使配置生效
exportfs -r
#可以查看到已经ok
exportfs
rpcinfo -p
检查 NFS 服务器是否挂载我们想共享的目录 /nfs/gerrit_git/:
挂载目录
#查看配置
showmount -e 192.168.0.130
#挂载共享目录
mount 192.168.0.130:/data/share /share
#如果要卸载目录
umount /share