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

    macrumors member

    Joined:
    Jan 30, 2008
    Location:
    St. Louis, MO
    #1
    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:
    Code:
    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:
    Code:
    do shell script "diskutil eject 'Macintosh Data'"
    do shell script "diskutil eject BOOTCAMP"
    Here are the details for setting up SleepWatcher:

    Tools
    SleepWatcher 2.2 (from http://www.bernhard-baehr.de/)

    Setup
    Install the SleepWatcher software:
    1. Execute the following commands in Terminal:
    Code:
    $ 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:
    Code:
    $ man sleepwatcher
    3. Create a shell script to unmount the partitions on wake using Terminal:
    Code:
    pico ~/.wakeup
    3. a. Enter the following as the contents:
    Code:
    #!/bin/sh
    diskutil eject 'Macintosh Data'
    diskutil eject 'BOOTCAMP'
    3. b. Set the wakeup script to be executable:
    Code:
    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:
    Code:
    cd ~/Library/LaunchAgents
    launchctl load de.bernhard-baehr.sleepwatcher-20compatibility-localuser.plist
    6. Verify that the agent is running in Terminal:
    Code:
    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. macrumors 6502

    Joined:
    Nov 13, 2011
    #2
    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. macrumors regular

    miker2209

    Joined:
    Jan 2, 2010
    #3
    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. macrumors 68000

    wikus

    Joined:
    Jun 1, 2011
    Location:
    Planet earth.
    #4
    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. macrumors 6502

    Joined:
    Nov 13, 2011
    #5
    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. macrumors regular

    Joined:
    Oct 14, 2008
    Location:
    New York City
    #6
    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. macrumors 65816

    Joined:
    Nov 16, 2011
    Location:
    Illinois
    #7
    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. macrumors 6502a

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

    Joined:
    Nov 16, 2011
    Location:
    Illinois
    #9
    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 dashboard....so iSTAT is definitely a HDD waker!
     
  10. macrumors member

    Joined:
    Mar 7, 2012
    #10
    Noob

    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.

    thanks.
     
  11. thread starter macrumors member

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

    dusk007

    Joined:
    Dec 5, 2009
    #12
    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. macrumors member

    Joined:
    Mar 7, 2012
    #13
    Automatic

    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 www.villasmanzanillo.com thanks so much for the script.
     
  14. macrumors member

    Joined:
    Mar 7, 2012
    #14
    From point 2 onward of sleepwatcher.
     
  15. macrumors member

    Joined:
    Mar 7, 2012
  16. macrumors member

    Joined:
    Mar 7, 2012
  17. macrumors member

    Joined:
    Dec 3, 2011
    #17
    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.

    +1
     
  18. macrumors member

    Joined:
    Mar 7, 2012
    #18
    Please Jrabbit have some compassion for those not so wise like you. Please explain from point 2 on.thx
     
  19. macrumors regular

    WonkyPanda

    Joined:
    Mar 29, 2010
  20. macrumors member

    Joined:
    Mar 18, 2013
    #20
    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.
     
  21. macrumors newbie

    imgmkr

    Joined:
    Jun 1, 2004
    Location:
    South Korea
    #21
    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