mount/nfs 共享目录
? linux ?    2019-01-11 16:22:44    1296    0    0
gua_l   ? linux ?

服务端开启NFS 服务, 配置共享目录 ,在客户端使用mount 命令将远程服务端的共享目录挂载到客户端本机挂载点



服务端:

#安装NFS

## ubuntu
sudo apt install nfs-kernel-server

## centos/redhat
yum -y install nfs-utils
rpm -qa nfs-utils


#,创建共享目录

mkdir /vob
chmod 777 /vob
#修改exports配置,允许目录共享
vi /etc/exports
/vob *(rw,no_root_squash,no_all_squash,no_subtree_check)


#重启/开启nfs服务

## ubuntu
sudo service nfs-kernel-server start
service  nfs-kernel-server status

## centos/redhat
systemctl start nfs
systemctl status nfs


 

客户端:
//将共享服务器的xx.xx.xx.xx:/version 挂载到本机/vob_jinsha(mount point)
//如果挂载点原本非空,则本机原来目录下的东西会被隐藏,进入到该目录会访问到共享目录的内容,umount可以恢复原本的目录。

apt-get install nfs-common
mount -t nfs -o rw xx.xx.xx.xx:/vob /vob_jinsh​

使用df -h 可以看到 目录已挂载


 

有时df -h 会一直卡住,出不来结果,这时可能是因为客户端挂载的一个共享目录在远程服务器上已经不存在,解决如下:
检查执行 :mount 查看共享目录列表是否有目录删除的情况
umount -l /var/www/html/qa-doc(mount point)
df -h 成功show

 

 

 

Pre: GitLab GEO 异地主副服务器同步--文档翻译

Next: linux shell 不同进制转换解析与示例

1296
Sign in to leave a comment.
No Leanote account? Sign up now.
0 comments
Table of content