Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I use Mac OS 10.6 to connect to a NAS drive using the afp protocol (Finder -> Go -> Connect To Server). I have set up the NAS to automatically power off during the day, and power on in the evening. Now what happens is this: each time the NAS powers off, the network share disappears. After the NAS has turned on again, I have to manually re-connect to the network share.

My girlfriend uses Windows 7 to connect to the same share. For her, when the NAS is off, the network drive is still visible in "My Computer", albeit with a "not connected" marker. When the NAS is on, she simply opens the network drive and Windows notices that it is available again.

Is there a way to make Mac OS behave in a comparable way to Windows here? I want Mac OS to automatically reconnect to the drive when it is available again (or at least when I try to access it).

I know I can turn the connection into a login item, but I rarely re-login. I want this to work automatically, while already being logged in.

share|improve this question
    
This has been bugging me for quite some time now. The thing is that you will probably get an error message like "The share has become unavailable" and the AFP mount disappears, right? –  slhck Jun 21 '11 at 12:55
    
I'm not sure about the compatibility of the script with afp, but take a look at this question. –  viking Jun 22 '11 at 19:56
add comment

1 Answer

up vote 15 down vote accepted

You will be able to get re-connect working with Autofs.

Apple has published a technical white paper on Autofs
http://images.apple.com/business/docs/Autofs.pdf

There is a comprehensive blog article by Rajeev Karamchedu
http://rajeev.name/2007/11/22/autofs-goodness-in-apples-leopard-105-part-i/

Also there is a third party application named AutomountMaker that enables this using GUI
http://jm.marino.free.fr/index.php?switch=sw_&title=AutomountMaker
(personally haven't used this software though)

Here is my setup using indirect mapping

(I personally use smb but afp should just work)

  1. edit master map file to add your custom map

    # sudo vi /etc/auto_master

    +add line

    /Network/NAS nas_map
  2. create /etc/nas_map add a following line

    # sudo vi /etc/nas_map

    +add line (note that you can add more than one line here)

    SHARE_NAME  -fstype=afp afp://USER:PASS@NAS_NAME/SHARE_NAME

    SHARE_NAME - directory name you want use to map /Network/NAS/SHARE_NAME
    USER:PASS - username and password (use 'guest' for anonymous login)
    NAS_NAME - name of your nas or the ip address
    SHARE_NAME - name of your share set by your NAS

    alternatively you can use following line to use smb instead of afp
    SHARE_NAME -fstype=smbfs ://USER:PASS@NAS_NAME/SHARE_NAME

  3. Set the permission on your map file

    # sudo chmod 600 /etc/nas_map
  4. Reload automount

    # sudo automount -vc

You now have access to your NAS via /Network/NAS/SHARE_NAME directory. When your server goes offline, you should be able to auto-connect to your NAS when it comes back online.

share|improve this answer
    
You sir, are awesome. –  bahamat Jun 27 '11 at 23:06
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.