Ubuntu挂载LEDE下分享的NFS盘

本文档介绍了如何在LEDE路由器上配置NFS服务,包括设置共享目录、权限选项等,并提供了在Linux和Windows系统中挂载NFS的具体步骤。

序言

最近入手了一台r7800,刷了LEDE,在这里记录一下配置NFS的过程。

正文

1、开启NFS

首先在LEDE上开启NFS服务,点击添加后输入共享名,允许的IP,选项,和目录。NFS配置
选项有如下选择:

rw:可读写的权限;
ro:只读的权限;
no_root_squash:登入到NFS主机的用户如果是root,该用户即拥有root权限;
root_squash:登入NFS主机的用户如果是root,该用户权限将被限定为匿名使用者nobody;
all_squash:不管登陆NFS主机的用户是何权限都会被重新设定为匿名使用者nobody。
anonuid:将登入NFS主机的用户都设定成指定的user id,此ID必须存在于/etc/passwd中。
anongid:同anonuid,但是变成group ID就是了!
sync:资料同步写入存储器中。
async:资料会先暂时存放在内存中,不会直接写入硬盘。
insecure:允许从这台机器过来的非授权访问。

博主在这里设置了,然后去挂载NFS没有成功,然后又在/etc/exports里面加入了设置,/etc/exports设置
在博主的LEDE下exports需要自己创建。

设定好后重启NFS服务。在楼主这里,服务在这。这里写图片描述
重启这两个服务。

如果我们在启动了NFS之后又修改了/etc/exports,这个时候我们就可以用exportfs命令来使改动立刻生效,该命令格式如下:
exportfs [-aruv]
-a :全部mount或者unmount /etc/exports中的内容
-r :重新mount /etc/exports中分享出来的目录
-u :umount 目录
-v :在 export 的时候,将详细的信息输出到屏幕上。
export

2、Linux挂载NFS

在Linux上,可以通过showmount -e hostname 来查看NFS目录。
这里写图片描述
可以看到两个共享的目录已经出来了。
然后通过mount来挂载目录。运行sudo mount -t nfs 192.168.1.1:/mnt/sda2 /media/ac/
来把远程/mnt/sda2 目录挂载到本机的/media/ac上。
在这里博主设置了开机自启,在/etc/rc.local的exit 0之前把刚才的命令加入。这样就能开机自启。

3、windows挂载NFS

这里只有win7旗舰版和企业版具有此功能。专业版和家庭版需要使用第三方软件实现。
首先去控制面板->程序->打开或关闭windows功能中把NFS服务下的软件都安装上。
windows功能

然后使用win+R键呼出运行,打开cmd,用cmd进行挂载。

windows挂载NFS

在这里,通过mount hostname path可以把远程目录挂载到 X盘,如图:

这里写图片描述
但是在这里,博主有一个问题,那就是windows自带的mount不能支持utf-8导致中文显示乱码。可以看到mount只支持如下编码。
这里写图片描述
暂时博主还没有找到办法。

我拿了coredump文件使用gdb进行调试,输出如下: cfets@cfets-virtualmachine:~$ gdb /usr/sbin/nfs-login-qt core.nfs-login-qt.124.c4e19cf711634771be825bc1ef918d20.17528.1752548330000000 GNU gdb (Debian 10.1-1.7+nfs5) 10.1.90.20210103-git Copyright (C) 2021 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /usr/sbin/nfs-login-qt... (No debugging symbols found in /usr/sbin/nfs-login-qt) warning: Can't open file /usr/local/share/fonts/msyhbd.ttf during file-backed mapping note processing warning: Can't open file /memfd:xorg (deleted) during file-backed mapping note processing warning: Can't open file /usr/local/share/fonts/msyh.ttf during file-backed mapping note processing warning: Can't open file /var/cache/fontconfig/e076aea9-b718-41e7-bd7d-e488b22595a8-le64.cache-7 during file-backed mapping note processing warning: Can't open file /var/cache/fontconfig/d996b94d-06e5-4799-9f5f-a7a97f4a4e9d-le64.cache-7 during file-backed mapping note processing [New LWP 17528] [New LWP 17531] [New LWP 17613] [New LWP 17597] [New LWP 17605] [New LWP 17598] [New LWP 17614] warning: Could not load shared library symbols for /lib/x86_64-linux-gnu/libkeinterface_zx.so.0. Do you need "set solib-search-path" or "set sysroot"? [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Core was generated by `/usr/sbin/nfs-login-qt'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00007fc677d710cb in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5 [Current thread is 1 (Thread 0x7fc67261cb00 (LWP 17528))] (gdb) bt #0 0x00007fc677d710cb in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5 #1 0x000055df7174c090 in ?? () #2 0x00007fc677d715e0 in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5 #3 0x00007fc677d715e0 in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5 #4 0x00007fc677d715e0 in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5 #5 0x000055df70e2203c in ?? () #6 0x00007fc676814fae in QWidget::event(QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5 #7 0x00007fc6768bd42e in QFrame::event(QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5 #8 0x00007fc6767d515f in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5 #9 0x00007fc6767dc04b in QApplication::notify(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5 #10 0x00007fc677d3afca in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Core.so.5 #11 0x00007fc6767db076 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5 #12 0x00007fc67682d011 in ?? () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5 #13 0x00007fc67683033e in ?? () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5 #14 0x00007fc6767d515f in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5 #15 0x00007fc677d3afca in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Core.so.5 #16 0x00007fc678115583 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /lib/x86_64-linux-gnu/libQt5Gui.so.5 #17 0x00007fc6780eb64c in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Gui.so.5 #18 0x00007fc671a2c7da in ?? () from /lib/x86_64-linux-gnu/libQt5XcbQpa.so.5 #19 0x00007fc676ed7e6b in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #20 0x00007fc676ed8118 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #21 0x00007fc676ed81cf in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #22 0x00007fc677d9251f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5 #23 0x00007fc677d3998b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5 #24 0x00007fc677d41c00 in QCoreApplication::exec() () from /lib/x86_64-linux-gnu/libQt5Core.so.5 #25 0x000055df70de4325 in main () (gdb)
07-17
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值