我怎样才能确保“绑定”文件系统是在其父文件系统之后安装的吗?

发布于 2024-12-25 09:19:25 字数 1009 浏览 1 评论 0原文

我最近在我的 fstab 中添加了几个条目,以允许我将一些目录重新绑定到文件系统树中的其他位置,如下所示

/mnt/smb/foo/bar /home/mishagale/sourcecode/bar bind defaults,bind 0 0

但是, /mnt/smb/foo 恰好是一个 SMB 文件系统(在 Samba 服务器上),具有fstab 中前面的行看起来像

//192.168.1.7/foo/ /mnt/smb/foo smbfs uid=1000,gid=1000,rw,auto,user,user=myuser,pass=mypass 0 0

(显然,这些行已被匿名)

问题是,现在我在启动时收到错误“/home/mishagale/sourcecode/bar 的光盘驱动器尚未准备好尚未出现或不存在。”如果我通过点击 S 跳过安装,系统会正常启动,但随后我必须手动安装有问题的安装点。

有没有办法让 Ubuntu 在成功挂载 foo 之前不要尝试挂载 bar ?我相信对于新贵来说这应该是可能的,但我不确定如何去做。

我可以(并且现在)只需将 noauto 选项放在 bar 上,并设置一个安装它们以便稍后运行的脚本,但这对我来说似乎是一个拼凑,并且我有兴趣学习 Upstart 的“正确”方法。

$ cat /etc/lsb-release ; uname -a
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.10
DISTRIB_CODENAME=oneiric
DISTRIB_DESCRIPTION="Ubuntu 11.10"
Linux myhostname 3.0.0-14-generic #23-Ubuntu SMP Mon Nov 21 20:28:43 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

I have recently added a couple of entries to my fstab to allow me to rebind some directories to elsewhere in my filesystem tree, like this

/mnt/smb/foo/bar /home/mishagale/sourcecode/bar bind defaults,bind 0 0

However, /mnt/smb/foo happens to be an SMB filesystem (on a Samba server), with a line earlier in fstab that looks like

//192.168.1.7/foo/ /mnt/smb/foo smbfs uid=1000,gid=1000,rw,auto,user,user=myuser,pass=mypass 0 0

(obviously, these lines have been anonymised)

The problem is, now I get an error at boot time "The disc drive for /home/mishagale/sourcecode/bar is not ready yet or not present." If I skip mounting by hitting S, the system boots fine, but I then have to manually mount the offending mountpoint.

Is there a way I can instruct Ubuntu not to attempt to mount bar until foo has been successfully mounted? I believe this should be possible with upstart, but I'm not certain how to go about that.

I could (and will for now) just put the noauto option on bar and set a script that mounts them to run later, but this seems like a kludge to me, and I'm interested in learning the "proper" way to do it with Upstart.

$ cat /etc/lsb-release ; uname -a
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.10
DISTRIB_CODENAME=oneiric
DISTRIB_DESCRIPTION="Ubuntu 11.10"
Linux myhostname 3.0.0-14-generic #23-Ubuntu SMP Mon Nov 21 20:28:43 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

护你周全 2025-01-01 09:19:25

理想情况下,您可以使用“自动挂载”来实现此功能,这样如果目录未在使用中,它将自动卸载,但只要您“cd”到它,它就会挂载并在使用期间保持活动状态。

顺便说一句,如果您可以使用 NFS 而不是 SMB,我强烈建议您这样做。 SMB 确实不友好,不能很好地处理断开连接。

有关自动挂载的更多信息,请查看自动挂载常见问题解答

Ideally you would implement this with 'automount' so that if the directory isn't in use it would automatically be unmounted, but as soon as you 'cd' to it, it'd mount and stay active as long as it's being used.

Incidentally, if you can use NFS instead of SMB, I would strongly suggest it. SMB is a really unfriendly and doesn't handle disconnects very well.

For more info on auto mount, peep the Automount FAQ

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文