我正尝试在Mac OS X上自动安装Windows SMB共享。
我尝试的第一件事是只把条目放在/etc/fstab :
$ dgrant$ cat /etc/fstab //darrengrant@d-grant/share /pc/share smbfs nodev,nosuid
这工作正常使用mount -a 。
但是我希望我的驱动器在机器打开的时候安装。 但是,当我重新启动计算机时,驱动器没有安装。 我检查控制台,我看到以下内容:
3/24/11 2:09:32 PM com.apple.launchd[1] *** launchd[1] has started up. *** 3/24/11 2:09:48 PM com.apple.autofsd[50] automount: Mount for //darrengrant@d-grant/share has no path for the directory to mount
我可以在命令行上通过简单的使用sudo automount重现这个错误信息。 我认为launchd调用了automountd ,它将所有东西都安装在/etc/fstab 。 文件/etc/auto_master包含一个引用或两个到fstab,所以这似乎是合理的。
我在automountd的实际源代码中发现'没有目录挂载的path'的错误,而且原因似乎是机器名和挂载目录名称之间的fstab行中缺less一个冒号。 我通过像这样添加冒号到fstab来使错误消失:
//darrengrant@mypc:/share /pc/share smbfs nodev,nosuid
但是在重新启动之后, automount不能使用完全不同的错误:
$ sudo automount -v automount: /net updated automount: /home updated [ pauses here for a couple of seconds ] automount: /pc/share updated automount: no unmounts # looks good so far ... $ mount .... map -static on /pc/share (autofs, automounted, nobrowse) # OK, a little different.. $ ls /pc/share ls: share: Host is down # fail.
这没有多大意义..为什么fstab不需要冒号,但automount呢? 什么是“主机倒塌”的一部分? networking和本地驱动器之间可能存在一些混淆?
这里有点混乱 mount读取/etc/fstab ,用于系统引导时应该挂载的内容。
automount读取/etc/auto_master ,并且仅在使用该目录时才用于挂载,而不是在之前。 它通常用于诸如NFS主目录之类的东西,只有在用户真正需要时才能挂载它们。 你也可以这样做,但是/etc/fstab不是在哪里做的。
如果你只是想在机器启动的时候安装你的smb共享,那么你所需要的只是你已经在/ etc / fstab中拥有的东西,还有一些你应该注意的问题。
soft选项 – 否则,如果你没有联网,挂载将挂起,并阻止你的系统启动正确 ~/Library/Preferences/nsmb.conf