nfs挂载失败

现象

[root@Zeratul:~]# mkdir  /mnt/sd0
[root@Zeratul:~]# mount 192.168.28.195:/nfsroot /mnt/sd0 -t nfs -o nolock;cd /mnt/sd0
[root@Zeratul:sd0]# ls
[root@Zeratul:sd0]# 

挂载完NFS结果啥也没有。

或是 去掉-t nfs 会直接报错。

[root@Zeratul:sd0]# 
[root@Zeratul:sd0]#  mount 192.168.28.195:/nfsroot /mnt/sd0  -o nolock;cd /mnt/sd0
mount: mounting 192.168.28.195:/nfsroot on /mnt/sd0 failed: No such device
[root@Zeratul:sd0]# 

排查

1.ping 目标机 -->OK
2.查看板端系统NFS模块

[root@Zeratul:sd0]# modprobe nfs
modprobe: applet not found
[root@Zeratul:sd0]# 

可以看到内核中没有加载NFS模块。

解决

  1. 在LINUX源代码目录下,make menuconfig进行如下设置
File systems  ---> 
           [*] Network File Systems  --->  
                   <*>   NFS client support
                    [*]         NFS client support for NFS version 3
                    [*]               NFS client support for the NFSv3 ACL protocol extension
                    [*]         NFS client support for NFS version 4 (EXPERIMENTAL) 
                    [*]               NFS client support for NFSv4.1 (DEVELOPER ONLY) 
                    [*]         Root file system on NFS
 [*] Networking support  ---> 
          Networking options  ---> 
                    [*]   IP: kernel level autoconfiguration 
  1. 配置完后,make uImage编译uImage
  2. 重新烧写内核

其它

有时在终端中输入make menuconfig会提示

$ make menuconfig 
  HOSTCC  scripts/kconfig/mconf.o
<command-line>:0:12: fatal error: curses.h: No such file or directory
compilation terminated.
scripts/Makefile.host:108: recipe for target 'scripts/kconfig/mconf.o' failed
make[1]: *** [scripts/kconfig/mconf.o] Error 1
Makefile:542: recipe for target 'menuconfig' failed
make: *** [menuconfig] Error 2

解决办法:

sudo apt-get install libncurses5-dev

posted @ 2021-11-23 20:15  海林的菜园子  阅读(494)  评论(0编辑  收藏  举报