My solution to spin down the HDD in the OptiBay

Discussion in 'MacBook Pro' started by jrabbit, Dec 16, 2011.

  1. jrabbit, Dec 16, 2011
    Last edited: Mar 8, 2012

    jrabbit macrumors member

    Jan 30, 2008
    St. Louis, MO
    There are numerous threads about removing the SuperDrive from the OptiBay, moving the HDD into the OptiBay, and installing an SSD in the main HDD space. I did these things using the DataDoubler from OWC; I'm very happy with the bracket quality and the overall results.

    Like many, I was annoyed with the fact that there seemed to be no way under Lion to make the HDD in the OptiBay spin down. Fiddling with the Spotlight settings, using pmset to adjust parameters, and so forth did not resolve the issue.

    To make peace, I did the following:
    1. Create "MountHDD" and "UnmountHDD" AppleScript "applications" that I can call easily using Alfred
    2. Set up SleepWatcher to run a script upon wakeup that will spin down the HDD volumes

    Here is the contents of the "MountHDD" script:
    do shell script "diskutil mount `diskutil list | grep 'Macintosh Data' | grep -o '\\(disk[0-9s]*\\)'`"
    do shell script "diskutil mount `diskutil list | grep 'BOOTCAMP' | grep -o '\\(disk[0-9s]*\\)'`"
    Here is the contents of the "UnmountHDD" script:
    do shell script "diskutil eject 'Macintosh Data'"
    do shell script "diskutil eject BOOTCAMP"
    Here are the details for setting up SleepWatcher:

    SleepWatcher 2.2 (from

    Install the SleepWatcher software:
    1. Execute the following commands in Terminal:
    $ sudo mkdir -p /usr/local/sbin /usr/local/share/man/man8
    $ sudo cp ~/Downloads/sleepwatcher_2.2/sleepwatcher /usr/local/sbin
    $ sudo cp ~/Downloads/sleepwatcher_2.2/sleepwatcher.8 /usr/local/share/man/man8
    2. Read the man page and think about the features of SleepWatcher you want to use:
    $ man sleepwatcher
    3. Create a shell script to unmount the partitions on wake using Terminal:
    pico ~/.wakeup
    3. a. Enter the following as the contents:
    diskutil eject 'Macintosh Data'
    diskutil eject 'BOOTCAMP'
    3. b. Set the wakeup script to be executable:
    chmod a+x ~/.wakeup
    4. Copy the sample 'de.bernhard-baehr.sleepwatcher-20compatibility-localuser.plist' file into the ~/Library/LaunchAgents directory
    5. Load the launchd agent configuration using launchctl in Terminal:
    cd ~/Library/LaunchAgents
    launchctl load de.bernhard-baehr.sleepwatcher-20compatibility-localuser.plist
    6. Verify that the agent is running in Terminal:
    launchctl list | grep sleepwatcher
    Now the HDD will spin up/down when my MBP wakes up, and if I need the HDD volumes, I just have Alfred run the MoundHDD application. The MBP is fast and quiet, and I'm happy.

    One additional note: the drives in the OptiBay are spun up and mounted upon system startup. I did not do anything to automatically unmount them, so if I'm not going to use them, I just call upon Alfred to run the UnmountHDD script.

    Hope this helps someone else...
  2. visim91 macrumors 6502

    Nov 13, 2011
    This is really cool.
    Now, about the opposite - a SSD in the optibay & HDD in the primary disc space - would I have to worry about such things?

    - The HDD is a storage bin for movies & media, SSD holds OSx etc.

    -Also, I do not have SATA III in my Mac, thus I opted to keep the spinning drive in the primary enclosure, and the solid-state in the optibay.
  3. miker2209 macrumors regular


    Jan 2, 2010
    Just try not to let any program wake the HDD, like if u have iStat pro make sure it's not checking the memory or the temps on the HDD and Spotlight go to privacy and add the HDD in the Not to Search list.
    Or easier just dismount the damn thing when your not using in, but IMO disabling Spotlight search or HDD and iStat pro will do the trick.
  4. wikus macrumors 68000


    Jun 1, 2011
    Planet earth.
    Its recommended that you have your SSD drive in the optibay. The main bay has some kind of anti-shock mechanism specifically for HDDs. You'll want to leave your stock HDD or replacement HDD in its default location, which is what I did (120gb Intel 320 SSD in optibay and Western Digital 1TB in the primary bay).
  5. visim91 macrumors 6502

    Nov 13, 2011
    We can do such things because our Mac's maximum speed remains 3.0 GB/s - also known as "SATA II".
    Those with newer models can attain speeds up to 6.0 GB/s - also known as "SATA III"; but, only if they elect to keep their SSD in the main bay, where the SATA III configuration is present.
    The optibay, in their situation, is only SATA II; thus, it would be counterproductive to place the SSD there.

    This is as far as I know, if I am wrong please correct me.
  6. Ant.honey macrumors regular

    Oct 14, 2008
    New York City
    I'm sure it's rewarding and such to write and run the scripts, but just dismounting seems like a lot less trouble to me. Also, perhaps I'm not as sensitive, but the spinning hard drive I don't really hear or at least it doesn't ever bother me. If it's cutting battery life, it's very insignificant. YMMV.
  7. Satnam1989 macrumors 65816

    Nov 16, 2011
    Excellent post, ill have to give it a try sometime when I'm up for it, been kinda looking for a solution maybe apple will be nice enough to add the spin down features into Lion once th enew MBP's hit the shelves and if they opt to remove the OD and add support for dual HDD's
  8. happle macrumors 6502a

    Jun 20, 2010
    woulding spinning down the drive often make the load cycle count go out of control?
  9. Satnam1989 macrumors 65816

    Nov 16, 2011
    I can't answer ur question but I did try another guys HDAPM command/instal instructions from this forum, changed the disk for it to work on to disk1(which is my HDD) from disk0, but noticed that it didn't work after I restarted my MBP that day....since then my heads been parking as it did before......btw if you can't run the commands just unmount your partitions(all that you have for ur optical bay HDD) make sure iSTAT is not running at all, I have my HDD Space monitoring and temperature turned off in iSTAT but it still wakes up my HDD as soon as I launch my iSTAT is definitely a HDD waker!
  10. VillasManzanill macrumors member

    Mar 7, 2012

    Hi jrabbit

    Could you explain it but as if you were explaing it to a baby or a 89 year old guy?

    i very new about scripts and terminal etc.

  11. jrabbit thread starter macrumors member

    Jan 30, 2008
    St. Louis, MO
    I'm not sure I can do better... which part/parts doesn't/don't make sense?
  12. dusk007 macrumors 68040


    Dec 5, 2009
    The stuff in his code that is supposed to make a script just needs to get into a script file.
    Launch AppleScript Editor (Spotlight should find it) copy the text. Click the compile button and save it as an Application in some folder where Spotlight and therefore Alfred can find it.
    I'd put it into a folder inside the Applications folder or into Applications/Utilities or just straight into Applications.

    For terminal stuff. Just open terminal and type exactly the stuff he wrote.
    Where he put a $ sign in fron of the line that is terminal commands. The $ is not supposed to be part of what you are typing. It starts with sudo ...
    On second glance all the following is also terminal stuff. pico is an editor you might as well edit the file in finder if you can find it. Though explaining how to find a hidden file in finder is probably more complicated than using pico.

    The whole sleepwatcher stuff is stuff you don't really need it is just convenience. I only ever used the un/mount scripts and hit it after wake up. Now with my data partition in exFAT I have no spin up problems anymore and don't require any of those scripts.
    The best solution is to just kill all apps that cause the spin ups, as well as ntfs drivers and use exFAT for Windows+OSX data drive. Exclude all NTFS drives from spotlight.
    No mount scripts needed and it just spins up and down when needed. Only the save dialog is annoyingly always causing a spin up.

    BTW learn a bit of terminal. It helps and will make you so much more confident with fixing stuff on your own. In my opinion most people that claim they don't know what to do when a solution is just a little difficult, usually just are afraid because they have this odd notion that a computer is such a fragile thing that breaks at the slightest little thing. People that know their way around computers are simply those that aren't afraid and just try stuff out.
    Tipp for terminal.
    $ man command
    displays the manual for whatever command you need. like "man ln"
    $ command -h or command --help
    displays usually a short explanation of possible options.

    A unix shell usually says nothing if everything worked and only displays errors if something went wrong.
  13. VillasManzanill macrumors member

    Mar 7, 2012

    i already did the applescripts, which i had to change the names of the hdd, i didn't know since it didn't said, so now whoever doesn't know much about this stuff now they know. i think i already installed sleep watcher, i just need to configure it to automatically run the script of unmount every time the computer wakes up, i already added the script to run automatically every time the computer starts. thats the help i need so far. thanks. i just can understand from point 2 of sleepwatcher onward. if you have some time to get in my computer with teamviewer (remote assistance program free) that will be awesome. thanks. you can contact me in trough my website and send an email trough it thanks so much for the script.
  14. VillasManzanill macrumors member

    Mar 7, 2012
    From point 2 onward of sleepwatcher.
  15. Jpalessi macrumors member

    Dec 3, 2011
    You are correct but the real life speed difference between II n III is hardly noticeable, which for me does not out weight the safety of having your hdd in the default bay. Plus you can find better deals on sata II ssd's. I have a samsung 470 series in my 13" mbp and it's dumb fast. boots in 2 spins of the wheel.

  16. VillasManzanill macrumors member

    Mar 7, 2012
    Please Jrabbit have some compassion for those not so wise like you. Please explain from point 2 on.thx
  17. WonkyPanda macrumors regular


    Mar 29, 2010
  18. nlynch77 macrumors member

    Mar 18, 2013
    I recently posted a similar project here. I wanted to be able to press only the "Eject" button to "turn the drive off" to save power. I am currently doing testing to prove that having the HDD turned off saves significant power.
  19. imgmkr macrumors newbie


    Jun 1, 2004
    South Korea
    So, how did test go?

    I've just upgraded mine and looking into a solutions for HDD in the second bay.
    with OS X 10.9.0

Share This Page