分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 技术分享

nfs下的exportfs命令和nfs客户端重新挂载

发布时间:2023-09-06 01:45责任编辑:赖小花关键词:暂无标签
工作中,如果使用了nfs服务器,会遇到修改nfs服务器配置的情况,如果想重新让客户端加载上修改后的配置,
但是又不能重启rpcbind服务,我们需要使用export命令了

exportfs命令常用选项-a 全部挂载或者全部卸载-r 重新挂载-u 卸载某一个目录-v 显示共享目录以下操作在服务端上

实验:两台centos7

vim /etc/exports
//增加
/tmp/ 192.168.133.0/24(rw,sync,no_root_squash)
exportfs -arv //不用重启nfs服务,配置文件就会生效
nfs服务不能随便重启,重启服务会对挂载了nfs的客户端有影响,
exportfs来自nfs-utils包
作用是修了配置后重载,不用重启服务。
服务器:

[root@JAMF nfsdir]# vim /etc/exports ????/home/nfsdir 172.16.22.0/24(rw,sync,all_squash,anonuid=1000,anongid=1000)/tmp 172.16.22.0/24(rw,sync,no_root_squash)[root@JAMF nfsdir]# exportfs -arvexporting 172.16.22.0/24:/tmpexporting 172.16.22.0/24:/home/nfsdir

客户端:

[root@zabbix ~]# showmount -e 172.16.22.247 ??????????????????????????Export list for 172.16.22.247:/tmp ????????172.16.22.0/24/home/nfsdir 172.16.22.0/24[root@zabbix ~]# mkdir /mnt/tmp[root@zabbix ~]# mount -t nfs -onolock 172.16.22.247:/tmp /mnt/tmp -o nolock 了,即在挂载nfs服务时,不加锁。 在客户端上执行:[root@zabbix ~]# touch /mnt/tmp/new.txt[root@zabbix tmp]# ll /mnt/tmp/new.txt ??-rw-r--r-- 1 root root 0 Mar 16 01:41 /mnt/tmp/new.txt

服务器:

[root@JAMF nfsdir]# ll /tmp/new.txt -rw-r--r-- 1 root root 0 Mar 16 01:41 /tmp/new.txt[root@zabbix mnt]# mount -t nfs -Oremount,nfsvers=3 172.16.22.247:/tmp /mnt/tmpmount.nfs: /mnt/tmp is busy or already mounted[root@zabbix mnt]# umount /mnt/tmp/ ???????????????????????????????????????????[root@zabbix mnt]# mount -t nfs -Oremount,nfsvers=3 172.16.22.247:/tmp /mnt/tmp

#NFS客户端问题:NFS 4版本会有该问题

客户端文件属主属组nobody

客户端挂载共享目录后,不管是root用户还是普通用户,创建新文件时属主、属组为nobody
客户端挂载时加上 -O nfsvers=3

[root@zabbix mnt]# mount -t nfs -Oremount,nfsvers=3 172.16.22.247:/tmp /mnt/tmpmount.nfs: /mnt/tmp is busy or already mounted[root@zabbix mnt]# umount /mnt/tmp/ ???????????????????????????????????????????[root@zabbix mnt]# mount -t nfs -Oremount,nfsvers=3 172.16.22.247:/tmp /mnt/tmp

客户端和服务端都需要
vim /etc/idmapd.conf //
把“#Domain = local.domain.edu” 改为 “Domain = xxx.com” (这里的xxx.com,随意定义吧),然后再重启rpcidmapd服务
服务器:

[root@JAMF nfsdir]# vim /etc/idmapd.conf [General]#Verbosity = 0# The following should be set to the local NFSv4 domain name# The default is the host‘s DNS domain name.Domain = jamf.oceanwing.com[root@JAMF nfsdir]# systemctl restart rpcidmapd客户端:[root@zabbix mnt]# vim /etc/idmapd.conf [General]#Verbosity = 0# The following should be set to the local NFSv4 domain name# The default is the host‘s DNS domain name.Domain = zabbix.oceanwing.com[root@zabbix mnt]# systemctl restart rpcidmapd

nfs下的exportfs命令和nfs客户端重新挂载

原文地址:http://blog.51cto.com/m51cto/2087738

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved