Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to automount a Windows SMB share on Mac OS X.

The first thing I tried was to put entries only in /etc/fstab:

$ dgrant$ cat /etc/fstab
//darrengrant@d-grant/share    /pc/share    smbfs    nodev,nosuid

This works fine using mount -a.

But I want my drives to be mounted whenever the machine is turned on. But the drives aren't getting mounted when I restart my computer. I check the Console and I see the following:

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

I can reproduce this error message on the commandline by a simple use of sudo automount. I think launchd calls automountd, that mounts everything in /etc/fstab. The file /etc/auto_master contains a reference or two to fstab, so that seems reasonable.

I found the 'no path for the directory to mount' error in the actual source for automountd, and it seems the cause is a missing colon in the fstab line between the machine name and mount directory name. I made the error disappear by adding the colon to fstab like this:

//darrengrant@mypc:/share   /pc/share   smbfs    nodev,nosuid

But after a reboot, automount doesn't work with an entirely different set of errors:

$ 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.

This doesn't really make much sense.. why does fstab not need the colon but automount does? And what is the 'Host is down' part all about? Some confusion between network and local drives perhaps?

share|improve this question
add comment

1 Answer

There's a bit of confusion here. mount reads /etc/fstab, and is used for things that should be mounted when the system boots.

automount reads /etc/auto_master, and is used to mount things only when the directory is used, and not before. It's typically used for things like NFS home directories, which should only be mounted when the user actually needs them. You can do that, too, but /etc/fstab is not where to do it.

If you just want to have your smb share mounted when the machine starts up, all you need is what you already have in /etc/fstab, with a couple of gotchas that you should be aware of.

  1. use the soft option - otherwise, if you're not networked, the mount will hang and prevent your system from booting correctly
  2. it looks like you're connecting without credentials. If you actually do need credentials in the fstab entry, be careful, since /etc/fstab is usually readable by anyone on the system, so your username and password used for the smb system will be exposed. There are ways around that by editing ~/Library/Preferences/nsmb.conf
share|improve this answer
    
Thankyou for your reply. Even just with fstab, I get a startup error from launchd and automount. I've edited my original post again to explain my problem in more detail. –  darren Mar 25 '11 at 4:21
    
@darren - sorry I haven't had a chance to test this. I plan to, and I'll let you know what I find out. –  malcolmpdx Mar 29 '11 at 4:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.