Go Back   MacRumors Forums > Apple Systems and Services > Mac Basics and Help

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 23, 2012, 01:05 AM   #1
Namtaro
macrumors regular
 
Join Date: Dec 2011
Automatically mount Sparsebundle?

Is there any way to do this?

I have a sparsebundle on a fileserver that I use for timemachine backups and everything's great... it's just that I have to manually mount it every time I wake the macbook from sleep.

I have tried dragging the sparsebundle into the login items, but that only mounts the shared harddrive and doesn't mount the sparsebundle itself.

Any solutions would be awesome, thanks!
Namtaro is offline   0 Reply With Quote
Old Nov 23, 2012, 09:41 AM   #2
Weaselboy
macrumors G5
 
Weaselboy's Avatar
 
Join Date: Jan 2005
I think you could do it with the below shell script in an Applescript launched at login.

Code:
hdiutil attach -mountpoint ~/myMountPoint mySparsebundle.dmg
Weaselboy is online now   1 Reply With Quote
Old Nov 23, 2012, 08:58 PM   #3
Namtaro
Thread Starter
macrumors regular
 
Join Date: Dec 2011
Sorry, I've never used Applescript before, any instructions to do so?
Namtaro is offline   0 Reply With Quote
Old Nov 24, 2012, 10:25 AM   #4
Weaselboy
macrumors G5
 
Weaselboy's Avatar
 
Join Date: Jan 2005
Quote:
Originally Posted by Namtaro View Post
Sorry, I've never used Applescript before, any instructions to do so?
Okay. Start the Applescript editor from /Applications/Utilities and paste in the text below. Change extDriveName to whatever your external drive is called. Also change mySparsebundle.dmg to whatever you sparsebundle is called. Now click Run to test. If it works okay, go ahead and save the Applescript wherever you want. Documents folder is fine. Now add the Applescript to your login items. That should do it.

Code:
do shell script "hdiutil attach -mountpoint /Volumes/extDriveName mySparsebundle.dmg"
Weaselboy is online now   1 Reply With Quote
Old Nov 24, 2012, 12:42 PM   #5
Namtaro
Thread Starter
macrumors regular
 
Join Date: Dec 2011
Quote:
Originally Posted by Weaselboy View Post
Okay. Start the Applescript editor from /Applications/Utilities and paste in the text below. Change extDriveName to whatever your external drive is called. Also change mySparsebundle.dmg to whatever you sparsebundle is called. Now click Run to test. If it works okay, go ahead and save the Applescript wherever you want. Documents folder is fine. Now add the Applescript to your login items. That should do it.

Code:
do shell script "hdiutil attach -mountpoint /Volumes/extDriveName mySparsebundle.dmg"



Quote:
do shell script "hdiutil attach -mountpoint /Volumes/Timemachine timemachine.sparsebundle"
That's what I've written so far and it's turning up an error
Quote:
error "hdiutil: attach failed - No such file or directory" number 1
You said to change extDriveName to my external drive... but I do not have the sparsebundle on an external drive, but on a networked drive. That might be the problem?
Namtaro is offline   0 Reply With Quote
Old Nov 25, 2012, 09:07 AM   #6
Weaselboy
macrumors G5
 
Weaselboy's Avatar
 
Join Date: Jan 2005
Quote:
Originally Posted by Namtaro View Post
That's what I've written so far and it's turning up an error

You said to change extDriveName to my external drive... but I do not have the sparsebundle on an external drive, but on a networked drive. That might be the problem?
Oh yes... that changes things. Follow this to mount the NAS at login then use the Applescript to mount the sparse bundle.

Change the mountpoint /Volumes/extDriveName section to the NAS location. Look toward the bottom of the page I linked and you will also see a way to add the network mount to the Applescript.

It is hard for me to do this without knowing what protocol you are using to share. If you post up the NAS share location, I'll try and string it all together into one script for you.
Weaselboy is online now   1 Reply With Quote
Old Nov 25, 2012, 12:38 PM   #7
Namtaro
Thread Starter
macrumors regular
 
Join Date: Dec 2011
Quote:
Originally Posted by Weaselboy View Post
Oh yes... that changes things. Follow this to mount the NAS at login then use the Applescript to mount the sparse bundle.

Change the mountpoint /Volumes/extDriveName section to the NAS location. Look toward the bottom of the page I linked and you will also see a way to add the network mount to the Applescript.

It is hard for me to do this without knowing what protocol you are using to share. If you post up the NAS share location, I'll try and string it all together into one script for you.
I"m using samba to share.

The NAS share location is - smb://192.168.1.10/Timemachine
The sparsebundle inside the shared location is - TimeMachine.sparsebundle

Thanks a lot for the help so far.
__________________
Late 2011 15" Macbook Pro - 2.4GHz i7 | 256GB Samsung 8 SSD | 16GB Memory | AMD Radeon HD 6770M
iPad Mini - Wifi 32GB iPhone 4 - 16GB
Time Machine on Networked Drive Guide
Namtaro is offline   0 Reply With Quote
Old Nov 25, 2012, 12:46 PM   #8
Weaselboy
macrumors G5
 
Weaselboy's Avatar
 
Join Date: Jan 2005
Quote:
Originally Posted by Namtaro View Post
I"m using samba to share.

The NAS share location is - smb://192.168.1.10/Timemachine
The sparsebundle inside the shared location is - TimeMachine.sparsebundle

Thanks a lot for the help so far.
Okay... try this in Applescript editor..

Code:
try
    mount volume "smb://192.168.1.10/Timemachine"
end try
do shell script "hdiutil attach -mountpoint smb://192.168.1.10/Timemachine TimeMachine.sparsebundle"
Weaselboy is online now   1 Reply With Quote
Old Nov 25, 2012, 01:05 PM   #9
Namtaro
Thread Starter
macrumors regular
 
Join Date: Dec 2011
Quote:
Originally Posted by Weaselboy View Post
Okay... try this in Applescript editor..

Code:
try
    mount volume "smb://192.168.1.10/Timemachine"
end try
do shell script "hdiutil attach -mountpoint smb://192.168.1.10/Timemachine TimeMachine.sparsebundle"
Hmm, gave me a 'hdiutil: attach failed - No such file or directory' error.

Used this and it looks to be working. Just added 'Volumes/TimeMachine/' before the sparsebundle
Code:
try
	mount volume "smb://192.168.1.10/Timemachine"
end try
do shell script "hdiutil attach -mountpoint smb://192.168.1.10/Timemachine Volumes/TimeMachine/TimeMachine.sparsebundle"
Do I save the Applescript somewhere and drag it into loginitems?
__________________
Late 2011 15" Macbook Pro - 2.4GHz i7 | 256GB Samsung 8 SSD | 16GB Memory | AMD Radeon HD 6770M
iPad Mini - Wifi 32GB iPhone 4 - 16GB
Time Machine on Networked Drive Guide

Last edited by Namtaro; Nov 25, 2012 at 01:16 PM.
Namtaro is offline   0 Reply With Quote
Old Nov 25, 2012, 02:31 PM   #10
Weaselboy
macrumors G5
 
Weaselboy's Avatar
 
Join Date: Jan 2005
Quote:
Originally Posted by Namtaro View Post
Hmm, gave me a 'hdiutil: attach failed - No such file or directory' error.

Used this and it looks to be working. Just added 'Volumes/TimeMachine/' before the sparsebundle
Code:
try
	mount volume "smb://192.168.1.10/Timemachine"
end try
do shell script "hdiutil attach -mountpoint smb://192.168.1.10/Timemachine Volumes/TimeMachine/TimeMachine.sparsebundle"
Do I save the Applescript somewhere and drag it into loginitems?
Excellent!

Yes... just save as an Applescript where ever you want. Documents is fine. Then just add it as a login item. All set.
Weaselboy is online now   1 Reply With Quote
Old Nov 25, 2012, 09:01 PM   #11
Namtaro
Thread Starter
macrumors regular
 
Join Date: Dec 2011
Quote:
Originally Posted by Weaselboy View Post
Excellent!

Yes... just save as an Applescript where ever you want. Documents is fine. Then just add it as a login item. All set.
Hmm, seems it doesn't work. When I save the script and add it as a login item, it only opens the script and doesn't actually run it. I have to manually press 'run'.

Nevermind, found the solution - I had to export it as an Application

Thanks for all the help, Weaselboy!
__________________
Late 2011 15" Macbook Pro - 2.4GHz i7 | 256GB Samsung 8 SSD | 16GB Memory | AMD Radeon HD 6770M
iPad Mini - Wifi 32GB iPhone 4 - 16GB
Time Machine on Networked Drive Guide

Last edited by Namtaro; Nov 25, 2012 at 10:23 PM.
Namtaro is offline   1 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Mac Basics and Help

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Help with a .sparsebundle file brsboarder Mac Applications and Mac App Store 2 Sep 14, 2013 10:21 PM
SparseBundle Password Arsalan523 OS X 10.8 Mountain Lion 0 Aug 19, 2013 12:32 PM
Auto mount sparsebundle? cclloyd Mac Basics and Help 0 Mar 2, 2013 06:35 PM
.sparsebundle question Morrile Mac Peripherals 0 Dec 10, 2012 04:55 PM
applescript help : Auto mount sparsebundle image at login MyRomeo OS X 10.8 Mountain Lion 1 Nov 13, 2012 09:25 AM

Forum Jump

All times are GMT -5. The time now is 10:34 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC