zoukankan      html  css  js  c++  java
  • nfs下的exportfs命令和nfs客户端重新挂载

    工作中,如果使用了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
  • 相关阅读:
    sqlserver调优-索引
    浮点数的这些坑,你未必知道-深入理解浮点数的规律
    生产环境部署springcloud微服务启动慢的问题排查
    redis传输协议规范-下(Redis Protocol specification)
    一步步完成“迷你版” 的ASP.NET Core框架
    安全漏洞整改系列(一)
    docker实战(二)之redis的使用
    docker实战(一)之Tomcat的安装
    docker安装步骤
    WPF后台操作前台元素之查找对象
  • 原文地址:https://www.cnblogs.com/soymilk2019/p/11044346.html
Copyright © 2011-2022 走看看