记一次centos7挂在nas盘的踩坑经过

背景

xxxxxxxxxx
开发服务器磁盘空间不足,申请挂在nas存储.

处理流程

  • 评估大小
  • 给总部负责存储同事发邮件
  • 登陆服务器挂在

踩坑经过

  1. 从申请到总部同事存储分配过程都很顺利

  2. 下面进行挂载

    • 执行命令 [root@ovz-big-dmp-01 ~]# mount -t nfs 172.16.138.134:/vol/abcd_big /abcd-dmp/file

      x
      [root@ovz-big-dmp-01 ~]# mount -t nfs 172.16.138.134:/vol/abcd_big  /abcd-dmp/file
      mount: 文件系统类型错误、选项错误、172.16.138.134:/vol/abcd_big 上有坏超级块、
             缺少代码页或助手程序,或其他错误
             (对某些文件系统(如 nfs、cifs) 您可能需要
             一款 /sbin/mount.<类型> 助手程序)
             有些情况下在 syslog 中可以找到一些有用信息- 请尝试
             dmesg | tail  这样的命令看看。
      • 问题所在

        centos7默认不支持挂在nfs文件系统. 安装包:yum install nfs-utils rpcbind

    • 再次执行命令 [root@ovz-big-dmp-01 ~]# mount -t nfs 172.16.138.134:/vol/abcd_big /abcd-dmp/file

      xxxxxxxxxx
      [root@ovz-big-dmp-01 ~]# mount -t nfs 172.16.138.134:/vol/abcd_big  /abcd-dmp/file
      等了好久。。。
      毛都没有。。。
      命令执行后不在报错,但是一直处于等待状态,类似于ping 逾时的现象
      • 问题发现
      xxxxxxxxxx
      [root@ovz-big-dmp-01 ~]# route  -n
      Kernel IP routing table
      Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
      0.0.0.0         xx.xx.xxx.1     0.0.0.0         UG    100    0        0 eno16777984
      xx.xx.xx.0     0.0.0.0         255.255.255.0   U     100    0        0 eno16777984
      172.16.134.0    0.0.0.0         255.255.254.0   U     100    0        0 eno33557248
      172.17.0.0      172.16.135.1    255.255.0.0     UG    100    0        0 eno33557248
      [root@ovz-big-dmp-01 file]# ip a
      1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
          inet 127.0.0.1/8 scope host lo
             valid_lft forever preferred_lft forever
          inet6 ::1/128 scope host 
             valid_lft forever preferred_lft forever
      2: eno16777984: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
          link/ether xxxx brd ff:ff:ff:ff:ff:ff
          inetxxxxxxxxxx/24 brd 10.130.81.255 scope global eno16777984
             valid_lft forever preferred_lft forever
          inet6 fe80::250:56ff:feb3:76fc/64 scope link 
             valid_lft forever preferred_lft forever
      3: eno33557248: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
          link/ether xxxxxxxxxx brd ff:ff:ff:ff:ff:ff
          inet 172.16.135.167/23 brd 172.16.135.255 scope global eno33557248
             valid_lft forever preferred_lft forever
          inet6 fe80::250:56ff:feb3:3cbb/64 scope link 
      172.16.135.167作为本机挂在nas使用,通过对比跟172.16.138.134不在一个网段,故通讯前需要路由.
      从上面看本机并没有到172.16.138.134网段的路由,fuck ......
      #增加一波路由
      [root@ovz-big-dmp-01 ~]# ip route add 172.16.0.0/16 via 172.16.135.1 dev eno33557248
      [root@ovz-big-dmp-01 ~]# route  -n
      Kernel IP routing table
      Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
      0.0.0.0         xx.xx.xx.1     0.0.0.0         UG    100    0        0 eno16777984
      xx.xx.xx.0     0.0.0.0         255.255.255.0   U     100    0        0 eno16777984
      172.16.0.0      172.16.135.1    255.255.0.0     UG    0      0        0 eno33557248
      172.16.134.0    0.0.0.0         255.255.254.0   U     100    0        0 eno33557248
      172.17.0.0      172.16.135.1    255.255.0.0     UG    100    0        0 eno33557248
      路由有了自然就挂载成功了