上周我一直在努力向我的网络添加一个(asustor)nas,终于到了可以通过 ubuntu 中的 nfs 和运行 rune-audio 的 raspberry-pi 挂载文件夹的地步。
我将它们安装在 root/nfs/"folder" 中并将其添加到 nautilus 侧边栏。现在我想在启动时自动挂载这些并通读:
https : //help.ubuntu.com/community/Autofs和,
如何设置 Automount/Autofs
我已经安装了 autofs。
但是当我手动将它安装到 auto.master 的规则时,我似乎不明白如何在终端中转换分配:
使用的手动挂载规则:sudo mount 192.168.0.200:/volume1/Public /nfs/Public
对此“转换”的帮助将不胜感激。
那是我假设将该规则添加到标准 auto.master 就足够了,还是应该使用间接规则?合并auto.nfs?
非常感谢您提供任何帮助。
添加:
由于 steeldriver 的帮助,我确实安装了文件夹。
但是除了上面提到的规则之外,我忘了提及:
sudo mount 192.168.0.200:/volume1/Public /nfs/Public。
我还需要安装:
须藤挂载 192.168.0.200:/share/USB1 /nfs/Music.
我认为这与实现类似,但是当它尝试以下操作时:
* -fstype=nfs,soft,intr,rsize=8192,wsize=8192,nosuid,tcp 192.168.0.200:/volume1/Public
* -fstype=nfs ,soft,intr,rsize=8192,wsize=8192,nosuid,tcp 192.168.0.200:/share/USB1
但这只给了我一个包含公共内容的音乐文件夹,而不是 USB1 内容。我在这里做错了什么?
要挂载 NFS 共享,我们需要安装 nfs-common:
sudo apt-get install nfs-common
Run Code Online (Sandbox Code Playgroud)
为了避免在每次重新启动后重新输入,我们将以下行添加到 /etc/fstab:
<nfs-server-IP>:/ /mnt nfs auto 0 0
Run Code Online (Sandbox Code Playgroud)
如果挂载后,/proc/mounts 中的条目显示为 ://(带有两个斜杠),那么您可能需要在 /etc/fstab 中指定两个斜杠,否则 umount 可能会抱怨它找不到挂载。
自动选项在启动时安装。但是,如果您的客户端使用在用户级别(登录后)管理的 wifi 连接,这将不起作用,因为网络在启动时不可用。在 Ubuntu 12.04 LTS 及更高版本中,wifi 连接默认在系统级别管理,因此在启动时自动挂载 NFS 共享应该可以正常工作
来源:https : //help.ubuntu.com/community/SettingUpNFSHowTo
使用 WIFI 最好使用 Autofs:
我们从安装 AutoFS 开始:
sudo apt install autofs
Run Code Online (Sandbox Code Playgroud)
我们编辑/etc/auto.master:
sudo nano /etc/auto.master
Run Code Online (Sandbox Code Playgroud)
内容:
#
# 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
Run Code Online (Sandbox Code Playgroud)
注释掉 (#) "+auto.master" 和 "+dir:/etc/auto.master.d" 并在底部添加行。我花了 2 个小时试图让它工作,但如果不添加 --ghost 选项,它就无法工作。如果有人知道为什么请评论。现在 /media/nfs 是将包含您的 NFS 共享的目录(您不必创建它,autofs 会为您完成),而 /etc/auto.nfs 是您共享的配置文件。我们现在就做:
sudo nano /etc/auto.nfs
Run Code Online (Sandbox Code Playgroud)
插入共享:
Backup 10.0.1.100:/Backup
Multimedia 10.0.1.100:/Multimedia
Run Code Online (Sandbox Code Playgroud)
现在备份目录10.0.1.100:/Backup将包含在 /media/nfs 中。
重启 autofs:
sudo systemctl restart autofs
Run Code Online (Sandbox Code Playgroud)
就是这样,享受你的分享。
| 归档时间: |
|
| 查看次数: |
23222 次 |
| 最近记录: |