首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >通过autonfs自动安装NFS

通过autonfs自动安装NFS
EN

Ask Ubuntu用户
提问于 2017-02-17 13:56:19
回答 1查看 29.3K关注 0票数 3

上周,我一直在努力为我的网络添加一个(asustor) nas,最后我可以通过ubuntu中的nfs和运行raspberry-pi的rune-音频安装文件夹。

我将它们安装在根/nfs/“文件夹”中,并将其添加到nautilus侧栏中。现在,我想在引导时自动挂载这些内容,并阅读了以下内容:

https://help.ubuntu.com/community/Autofs和,

如何设置Automount/Autofs

我安装了autofs。

但是,当我手动将任务挂载到auto.master规则时,我似乎不知道如何转换终端中的分配:

手动安装规则: sudo挂载192.168.0.200:/volume1 1/Public /nfs/Public

对此“转换”的帮助将不胜感激。

也就是说,我假设将该规则添加到标准auto.master中就足够了,还是应该使用间接规则?不相关的auto.nfs?

对于任何援助,我们都要事先表示感谢。

增添:

由于steeldriver的帮助,我确实安装了文件夹。

但我忘记提及,除了上述规则外:

数多山192.168.0.200:/volume1 1/Public /nfs/Public。

我还需要安装:

数多山192.168.0.200:/share/USB1 1 /nfs/Music。

我认为这与实现类似,但当它尝试以下操作时:

* -fstype=nfs,软,intr,rsize=8192,wsize=8192,nosuid,tcp 192.168.0.200:/volume1 1/Public

* -fstype=nfs,软,intr,rsize=8192,wsize=8192,nosuid,tcp 192.168.0.200:/share/USB1 1

但这只给了我一个带有公共内容的音乐文件夹,而不是USB1内容。我在这里做错什么了?

EN

回答 1

Ask Ubuntu用户

发布于 2017-02-17 15:13:17

要挂载NFS共享,我们需要安装nfs-通用的:

代码语言:javascript
复制
sudo apt-get install nfs-common

为了避免在每次重新启动后重新键入该文件,我们将以下行添加到/etc/fstab中:

代码语言:javascript
复制
<nfs-server-IP>:/   /mnt   nfs    auto  0  0

如果挂载后,/proc/mounts中的条目显示为:// (带有两个斜杠),则可能需要在/etc/fstab中指定两个斜杠,否则umount可能会抱怨它找不到挂载。

自动选项在启动时挂载。但是,如果客户端使用在用户级别(登录后)管理的wifi连接,这将无法工作,因为网络在启动时将不可用。在Ubuntu 12.04 LTS和更高版本中,wifi连接默认是在系统级别管理的,因此在引导时自动挂载NFS共享应该可以正常工作。

来源:https://help.ubuntu.com/community/SettingUpNFSHowTo

带WIFI最好使用Autofs:

我们从安装AutoFS开始:

代码语言:javascript
复制
sudo apt install autofs

我们编辑/etc/auto.master:

代码语言:javascript
复制
sudo nano /etc/auto.master

内容:

代码语言:javascript
复制
#
# Sample auto.master file
# This is a 'master' automounter map and it has the following format:
# mount-point [map-type[,format]:]map [options]
# For details of the format look at auto.master(5).
#
#/misc  /etc/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
#       "nosuid" and "nodev" options unless the "suid" and "dev"
#       options are explicitly given.
#
#/net   -hosts
#
# Include /etc/auto.master.d/*.autofs
# The included files must conform to the format of this file.
#
#+dir:/etc/auto.master.d
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
#+auto.master

/media/nfs /etc/auto.nfs --ghost

注释掉(#) "+auto.master“和"+dir:/etc/auto.master.d”,并在底部添加行。我花了两个小时试图让它工作,不知怎么的,它是行不通的,而不添加-鬼怪选项。如果有人知道为什么请评论。现在/media/nfs是包含NFS共享的dir (您不必创建它,autofs是为您创建的),/etc/auto.nfs是您的共享的配置文件。我们现在要这样做:

代码语言:javascript
复制
sudo nano /etc/auto.nfs

插入股票:

代码语言:javascript
复制
Backup      10.0.1.100:/Backup
Multimedia  10.0.1.100:/Multimedia

现在备份dir10.0.1.100:/ Backup将接受/media/nfs。

重新启动autofs:

代码语言:javascript
复制
sudo systemctl restart autofs

就这样,享受你们的股份吧。

票数 10
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/884389

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档