Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Mount and unmount external drives easily via AppleScript ' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Mount and unmount external drives easily via AppleScript
Authored by: ctapley on Feb 14, '12 06:18:17PM

I have basically the same need for the same reason. I have a MBP 13 2.8 running 10.7.3. I have added a SSD as the primary drive and moved my regular HDD to the optical bay. Most of the stuff I do is on the SSD, but it is nice to have 750 gig of extra storage. However I don't like the extra heat and the slower performance when the HDD is mounted.
My solution was to write a quick script (In Bash because I am old school and not much of a programmer to start with). I called my script mount_HD and it reads like this..

bash-3.2$ more mount_HD


diskutil mountDisk Data_Storage
I also have an unmount utility as follows..

bash-3.2$ more eject_HD
diskutil unmountDisk /Volumes/Data_Storage && exit

For each script make it executable like this...

chmod +x {scriptname_here}

For each of these scripts I put them in a directory, made the directory part of my path search and then made an alias of the scripts and dropped it on my desktop. Now I can click the 'Eject' item to unmount, or the 'Mount' button to mount the drive. This is surely not as robust or elegant solution as the other possible solutions offered here, but I think easy to set up on just about any Mac. If you want the terminal session to close the window after it runs the script you can adjust that in the preferences for terminal (Which I did as I rarely use terminal for anything other than running this kind of script). Also you can make the 'unmount' item a startup item and automate the configuration of your system which I did in order to keep the HDD unmounted unless I needed it.

Happy scripting!

[ Reply to This | # ]