mount.nfs: No such device

NFS挂载文件夹报错"mount.nfs: No such device"

# 执行挂载命令报错
[root@VM-0-6-centos /]# mount -t nfs 172.16.0.32:/tmp/test /tmp/test06
mount.nfs: No such device

原因分析
在卸载nfs服务的时候我把内核里面的nfs模块一起删掉了,导致重装nfs服务后,服务器不能正常挂载文件

# 查看内核中的nfs模块
[root@VM-0-32-centos tmp]# ll /usr/lib/modules/3.10.0-1160.31.1.el7.x86_64/kernel/fs
total 108
-rw-r--r-- 1 root root 5996 Jun 10  2021 binfmt_misc.ko.xz
drwxr-xr-x 2 root root 4096 Jun 25  2021 btrfs
drwxr-xr-x 2 root root 4096 Jun 25  2021 cachefiles
drwxr-xr-x 2 root root 4096 Jun 25  2021 ceph
drwxr-xr-x 2 root root 4096 Jun 25  2021 cifs
drwxr-xr-x 2 root root 4096 Jun 25  2021 cramfs
drwxr-xr-x 2 root root 4096 Jun 25  2021 dlm
drwxr-xr-x 2 root root 4096 Jun 25  2021 exofs
drwxr-xr-x 2 root root 4096 Jun 25  2021 ext4
drwxr-xr-x 2 root root 4096 Jun 25  2021 fat
drwxr-xr-x 2 root root 4096 Jun 25  2021 fscache
drwxr-xr-x 2 root root 4096 Jun 25  2021 fuse
drwxr-xr-x 2 root root 4096 Jun 25  2021 gfs2
drwxr-xr-x 2 root root 4096 Jun 25  2021 isofs
drwxr-xr-x 2 root root 4096 Jun 25  2021 jbd2
drwxr-xr-x 2 root root 4096 Jun 25  2021 lockd
-rw-r--r-- 1 root root 5224 Jun 10  2021 mbcache.ko.xz
drwxr-xr-x 2 root root 4096 Jun 25  2021 nfs_common
drwxr-xr-x 2 root root 4096 Jun 25  2021 nfsd
drwxr-xr-x 2 root root 4096 Jun 25  2021 nls
drwxr-xr-x 2 root root 4096 Jun 25  2021 overlayfs
drwxr-xr-x 2 root root 4096 Jun 25  2021 pstore
drwxr-xr-x 2 root root 4096 Jun 25  2021 squashfs
drwxr-xr-x 2 root root 4096 Jun 25  2021 udf
drwxr-xr-x 2 root root 4096 Jun 25  2021 xfs

在内核里面我们能看到确实没有nfs这个模块的文件夹了,确实被我删掉了

处理方法

# 1、在其他服务器内核中拷贝nfs文件
scp -rp /usr/lib/modules/3.10.0-1160.31.1.el7.x86_64/kernel/fs/nfs 172.16.0.32:/usr/lib/modules/3.10.0-1160.31.1.el7.x86_64/kernel/fs/

# 2、安装高版本的内核到本服务器,然后从新的内核中拷贝一份到旧的内核中
# 我这里是下载高版本的内核安装
#下载地址:https://pkgs.org/search/?q=kernel
cd /tmp
wget http://mirror.centos.org/centos/7/updates/x86_64/Packages/kernel-devel-3.10.0-1160.36.2.el7.x86_64.rpm

wget http://mirror.centos.org/centos/7/updates/x86_64/Packages/kernel-3.10.0-1160.36.2.el7.x86_64.rpm

 yum localinstall -y kernel-*
 cp -r /usr/lib/modules/3.10.0-1160.36.2.el7.x86_64/kernel/fs/nfs /usr/lib/modules/3.10.0-1160.31.1.el7.x86_64/kernel/fs/

测试

#在客服端测试挂载
[root@VM-0-6-centos fs]# mount -t nfs 172.16.0.32:/tmp/test /tmp/test06

#在服务端测试创建文件
[root@VM-0-32-centos fs]# cd /tmp/test/
[root@VM-0-32-centos test]# ll
total 0
[root@VM-0-32-centos test]# touch test.txt

#在客户端查看新增文件
[root@VM-0-6-centos test06]# ll
total 0
-rw-r--r-- 1 root root 0 Mar  6 13:56 test.txt
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值