因此,我尝试通过 NFS 以编程方式共享和取消共享挂载点。(我意识到这可能不是最好的方法,但我正在使用别人的代码。)在我的服务器上,我通过调用来导出挂载点
exportfs -o ro,no-root-squash :/mnt/usb
这似乎工作正常;我的客户端可以挂载服务器:/mnt/usb,查看文件等。问题是我相应的尝试取消导出
exportfs -u :/mnt/usb
什么都不做。(这是因为没有任何客户端在任何时候尝试访问该挂载。)根据我对文档的阅读,这应该可行。我是不是误读了什么?
/mnt/usb 不在我的 /etc/exports 文件中。
这是我的 uname -a:
Linux somehost 2.6.30.9 #1 SMP Wed Aug 10 12:09:51 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
以下是示例序列的复制粘贴。在“exportfs -u”之后,我预计 /mnt/usb 不会出现在导出条目列表中。
[root@somehost ~]# exportfs -r
[root@somehost ~]# exportfs -iv
/mnt/ipl <world>(ro,wdelay,root_squash,no_subtree_check,anonuid=-1,anongid=65534)
[root@somehost ~]# exportfs -v -o ro,no_root_squash :/mnt/usb
exporting :/mnt/usb
[root@somehost ~]# exportfs -iv
exportfs: No host name given with /mnt/usb (ro,sync,wdelay,hide,nocrossmnt,secure,no_root_squash,no_all_squash,no_subtree_check,secure_locks,acl,mapping=identity,anonuid=65534,anongid=65534), suggest *(ro,sync,wdelay,hide,nocrossmnt,secure,no_root_squash,no_all_squash,no_subtree_check,secure_locks,acl,mapping=identity,anonuid=65534,anongid=65534) to avoid warning
/mnt/ipl <world>(ro,wdelay,root_squash,no_subtree_check,anonuid=-1,anongid=65534)
/mnt/usb <world>(ro,wdelay,no_root_squash,no_subtree_check,anonuid=65534,anongid=65534)
[root@somehost ~]# exportfs -u :/mnt/usb
exportfs: No host name given with /mnt/usb (ro,sync,wdelay,hide,nocrossmnt,secure,no_root_squash,no_all_squash,no_subtree_check,secure_locks,acl,mapping=identity,anonuid=65534,anongid=65534), suggest *(ro,sync,wdelay,hide,nocrossmnt,secure,no_root_squash,no_all_squash,no_subtree_check,secure_locks,acl,mapping=identity,anonuid=65534,anongid=65534) to avoid warning
[root@somehost ~]# exportfs -iv
/mnt/ipl <world>(ro,wdelay,root_squash,no_subtree_check,anonuid=-1,anongid=65534)
/mnt/usb <world>(ro,wdelay,no_root_squash,no_subtree_check,anonuid=65534,anongid=65534)
[root@somehost ~]#
谢谢!
答案1
解决了我自己的问题。 unexport 需要
exportfs -u *:/mnt/usb