Quick Tip: How to mount a TimeMachine network drive at login

Quick TipI’ve had a lot of feedback from my article on using readyshare drives for TimeMachine backups. The one glitch I’ve found is that I have to remount the sparsebundle file every time I log in. Here’s a way to fix that issue. 

You may have seen articles that have you simply drag the drive  into your Login Items profile to have it remount on login. This hasn’t worked for me. It may be due to the fact that the readyshare drive has to be mounted first, I’m not 100% sure. However, we can create a simple AppleScript that will do the job for us.

Fire up the AppleScript editor (under Applications) and paste in the following script:

Note: Your path(s) will vary based on your share and sparse bundle names.

Before running this script, make sure your readyshare drives have been unmounted. Click the “run” button and verify the results. If you open up Finder, you should see your ReadyShare drive in the “Shares” section and your Time Machine drive listed in the “Devices” section.

If all is successful, use the File->Export dialog, making sure to change the format to “Application”. You can name it whatever you’d like.

Once this is done, open up the “Users and Groups” settings, select your profile, and drag the application file from finder into the Login Items section.

Next time you reboot your computer, all your drives should come back for you automatically.

Enjoy!

 

26 thoughts on “Quick Tip: How to mount a TimeMachine network drive at login

  1. If I may, I’d like to offer a suggestion to the script above. The whole thing failed when I wasn’t in the same network as usual, so just to save me a couple of clicks, I added

    on error
    return

    Just above the End Try line. If the share is not available, the script stops quietly there.

    Thanks for this. It really helped and saved me hours of frustration.

    1. Good catch. I personally like to see an error message like this so I can diagnose things further, but since you have first comment, others will be able to see this and update their scripts as needed. Thanks!

  2. The first command works without a hitch. The second command returns this error: error “hdiutil: attach failed – Permission denied” number 1. Any advice?

    1. Either try putting sudo in front of the command to run as root or make sure in the ReadyShare settings that you don’t have your USB drive access password protected.

  3. And on that point are 87 results; an hour ago from Matt is– on
    that point’s dozens of riots. So why would you and tied if it does
    deficiency, buy twitter followers using paypal I believe our braveness to try new things is what disunites us from early masses.
    As you can see to me.

    1. I’m working on a permanent solution for this myself. I created a script file to auto mount the drive (see the link in this article), but haven’t found a good tool or script yet to detect when the connection is lost

      1. Thank you so much for your tutorials!
        You can use ControlPlane (found at http://www.controlplaneapp.com) to run your script on a wakeup event.
        Here’s what I did:
        – Create a Context. I named it TimeMachineAtWake
        – In the Evidenced Sources tab, make sure Sleep/Wake event is selected
        – Go to the Rules tab. Set a Rule to “Sleep/Wake” at 100%.
        – Go to the Actions tab. Click the plus sign menu, select Application Actions, Select Open File or Application, select your Applescript app. Make sure to select from the Context menu and that it’s set for On Arrival.

        With this in place, you don’t have to have your script in your Login items anymore. The only issue I’m having so far is that I get an “hdiutil:attach failed- No such file or directory” if the network drive hasn’t unmounted yet. I’m guessing there’s something in ControlPlane that I can do, I just haven’t figured it out yet.

        1. I was able to fix my issue with the hdiutil:attach error when the network drive was still mounted. To get my drive to unmount, I made another Applescript app, with shell “hdiutil unmount /Volumes/volumename” and told ControlPlane to open that when the computer goes to sleep.

          I’m not even qualified enough to be called an amateur with this stuff, as I use Google to learn how to do pretty much anything, so there may be a better way to do this. :)

    1. Correct. If you have a password protected drive, I’m not sure how to help, unless you can setup a script that will mount it with the username and password. This solution assumes you leave that share open on the network.

What are your 10 bits on the matter? I want to know!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s