工作中,如果使用了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 -arv
exporting 172.16.22.0/24:/tmp
exporting 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/tmp
mount.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/tmp
mount.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
原文链接:https://blog.51cto.com/m51cto/2087738

nfs下的exportfs命令和nfs客户端重新挂载的更多相关文章

  1. Linux centosVMware NFS exportfs命令、NFS客户端问题、FTP介绍、使用vsftpd搭建ftp

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

  2. exportfs命令、NFS客户端问题、FTP介绍、使用vsftpd搭建ftp

    6月22日任务 14.4 exportfs命令14.5 NFS客户端问题15.1 FTP介绍15.2/15.3 使用vsftpd搭建ftp 14.4 exportfs命令 当我们修改nfs的配置文件e ...

  3. NFS相关、NFS服务端安装配置、exportfs命令、nfs客户端的问题

    1.NFS (network file system,基于RPC协议) 2.NFS服务端安装配置安装服务端:yum install nfs-utils rpcbind -y安装客户端:yum inst ...

  4. exportfs命令 – 管理NFS服务器共享的文件系统

    exportfs命令需要参考配置文件"/etc/exportfs".也可以直接在命令行中指定要共享的NFS文件系统. 语法格式: export [参数] [目录] 常用参数: -a ...

  5. exportfs命令 NFS客户端问题 FTP介绍 使用vsftpd搭建ftp

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

  6. man exportfs(exportfs命令中文手册)

    本人译作集合:http://www.cnblogs.com/f-ck-need-u/p/7048359.html exportfs() System Manager's Manual exportfs ...

  7. NFS exportfs 命令

    exportfs 是在服务端上使用的命令,主要用来操作挂载的目录,比如我们修改了NFS配置文件,需要重启NFS服务,如果客户端正在读写,那么重启NFS服务对客户端是有影响的,因此 exportfs 命 ...

  8. 使用nfsstat命令查看NFS服务器状态

    转载于:http://www.cnblogs.com/jankie/archive/2011/09/03/2165851.html nfsstat命令显示关于NFS和到内核的远程过程调用(RPC)接口 ...

  9. centos配置nfs服务详细步骤(centos开启nfs服务)

    一.NFS服务简介 NFS 是Network File System的缩写,即网络文件系统.一种使用于分散式文件系统的协定,由Sun公司开发,于1984年向外公布.功能是通过网络让不同的机器.不同的操 ...

随机推荐

  1. LightOJ 1030 Discovering Gold (概率/期望DP)

    题目链接:LightOJ - 1030 Description You are in a cave, a long cave! The cave can be represented by a \(1 ...

  2. Vue环境搭建及第一个helloWorld

    Vue环境搭建及第一个helloWorld 一.环境搭建 1.node.js环境安装配置  https://www.cnblogs.com/liuqiyun/p/8133904.html 或者 htt ...

  3. PAT甲级——A1153 DecodeRegistrationCardofPAT【25】

    A registration card number of PAT consists of 4 parts: the 1st letter represents the test level, nam ...

  4. UVA1632_Alibaba

    题目链接 大致题意:直线上面有n个点,第i个点坐标为xi,它会在di时间消失,你可以选择从任何位置出发,求访问完所有点的最短时间,无解输出no solution 思路:这有一个难点就是,不知道状态该怎 ...

  5. dcoker镜像的分层

    镜像分层的好处:复用节省磁盘空间,相同的内容只需加载一份到内存 修改dockerfile之后,再次构建速度加快 docker优化: 1.尽可能地选择体积小的linux发行版,比如alpine 2.尽可 ...

  6. Cococs2d-x学习路线

    |   版权声明:本文为博主原创文章,未经博主允许不得转载. Cocos2D-X推荐书: Cocos2d-x权威指南

  7. volatile在嵌入式系统中的用法

    今天参加一家公司的嵌入式C语言笔试,其中有道主观题谈到在嵌入式系统中volatile变量的用法.平时学习C语言没怎么用到,只用到过static和extern的变量,很惭愧没答上来.嵌入式C语言笔试经常 ...

  8. JavaScript翻转字符串方法

    先把字符串转化成数组String.prototype.split(),再借助数组的reverse方法翻转数组顺序(Array.prototype.reverse()),然后把数组转化成字符串. 使用的 ...

  9. LeetCode Array Easy 26.Remove Duplicates from Sorted Array 解答及疑惑

    Description Given a sorted array nums, remove the duplicates in-place such that each element appear ...

  10. react 16.3+ 新生命周期

    react 16.3版本出现了两个新的生命周期函数,并将逐渐废弃componentWillMount().componentWillReceiveProps().componentWillUpdate ...