How to keep Optibay hard drive in sleep mode until needed

Discussion in 'MacBook Pro' started by ArmanUV, Aug 17, 2011.

  1. ArmanUV macrumors member

    Joined:
    Jul 15, 2010
    #1
    I recently installed a SSD in my MBP and I had problems keeping the spinning hard drive in sleep mode. You can follow this guide to decrease the amount of time it takes for the hard drive to sleep. The default is 10 minutes which is way to high. You can either use Cocktail or use the "sudo pmset -a disksleep X" command in terminal(replace x with number of minutes). Then you need to disable spotlight to prevent it from waking up the drive every 5 minutes. There are two methods to do this:
    1. Adding the volumes on the HD to spotlight privacy list in system preferences: doing this disables searching altogether for those volumes. you won't be able to search the HD contents at all.
    2. Using terminal to disable indexing: you will still be able to search using spotlight but it will be significantly slower.

    The second method alone did NOT work for me. For some reason, Spotlight kept waking the drive up every 5 minutes or so. Doing both did the trick. You can check to see if both indexing and searching are disabled by using the "sudo mdutil -a -s" command. The output should look something like this:
    Code:
    /:
    	Indexing enabled. 
    /Volumes/BOOTCAMP:
    	Indexing and searching disabled.
    /Volumes/OS X Data:
    	Indexing and searching disabled.
    /Volumes/Win7 Data:
    	Indexing and searching disabled.
    /Volumes/iHD Clone:
    	Indexing and searching disabled.
    Now, download and install Apple CHUD Tools. Then search for SpindownHD and open it to monitor the status of your drives:
    [​IMG]

    (Don't worry about the "Disk sleep after 10 minutes idle" checkbox. It seems broken and doesn't affect the value we set in Terminal)

    If at this point the HD sleeps properly then you're in luck. For me, the drive woke up once in a while for no apparant reason. Also, everytime you open an open/save dialogue, it starts spinning. To make sure that the OS doesn't wake up the HD by mistake, you need to do two things:

    1.Mount/Unmount the drive as needed: There are numerous toturials about this on the web, but the best one which I found that utilizes Growl for noticifications is this:
    (Credit goes to here)

    Just replace "iHD Clone" in the first line with the name of one of volumes on the HD. This script mounts/unmounts all the volumes on the HD and then notifies Growl.
    If you're using Alfred or a similar app, you can add this script as an extension which then you can launch by a couple of keystrokes.
    [​IMG]

    2.Prevent OS X from automounting the volumes at boot: To do this, you need to create a file by the name of "fstab" in /etc. Let's say you have three volumes on the HD. Two of them are formatted with HFS and one with ExFat.

    Open terminal and enter "sudo pico /etc/fstab". Then write this in the pico text editor:
    Code:
    UUID=1522294B-79B4-3F5E-B02B-52032B4DF645 none hfs rw,noauto
    UUID=B5F04909-36E4-30D4-B1D4-8321A831D240 none hfs rw,noauto
    UUID=494833FE-64F7-3B84-B9B1-4F89118B54AA none exfat rw,noauto
    
    To find the UUID of your volumes, open Disk Utility then select the volume and open the info window by pressing cmd+i . Then, replace the example value above with the UDID of your volume from the info window. You also need to specify the file system of the volume just like the example. For HFS+ or HFS+ journaled use "hfs" as the file system value. For FAT32, use "msdos". For ExFat, use "exfat".
    Save the file (control+o) and then exit (control+x).

    Now restart. Then open Disk Utility to confirm that the volumes are unmounted(grey).

    That's it. Enjoy your perfectly silent MBP with increased battery life!
     
  2. matrix808 macrumors regular

    Joined:
    Jun 7, 2010
    #2
    awesome, was just gonna make a thread regarding this issue. need to go home and try this now.
     
  3. tjb1, Aug 17, 2011
    Last edited: Aug 17, 2011

    tjb1 macrumors 68000

    Joined:
    Aug 26, 2010
    Location:
    Pennsylvania, USA
    #3
  4. ArmanUV thread starter macrumors member

    Joined:
    Jul 15, 2010
    #4
    You can sign up for a free Safari developer account which gives you access to developer downloads. I could share it here but I guess that is against the rules.

    ----------

    Just an FYI: Disk monitoring programs such as iStat Pro or iStat menus may wake the drive regardless of their mount status. I'm using iStat menus with the disk activity tab and "monitor s.m.a.r.t status" option disabled and I can confirm it doesn't wake the drive unless you open its preferences. I'm not sure about iStat Pro though.
     
  5. adrian1480 macrumors 6502

    Joined:
    Sep 2, 2010
    #5
    good thread.

    but even with my HDD staying spun up, I'm getting ~6 on my 2011 17". It's just not a big deal for me. plus, I really like Spotlight and want it indexing.
     
  6. ArmanUV thread starter macrumors member

    Joined:
    Jul 15, 2010
    #6
    If you unmount the drive when you don't need it, you can leave spotlight on. Think of the optibay as an external hard drive. you plug(mount) it when you need it, then unplug(unmount) it when you are done.
     
  7. wct097 macrumors 6502

    Joined:
    Nov 30, 2010
    #7
    Good thread. I personally gave up on the idea about one week into ownership. Mounting/unmounting was too annoying for practical use for me. These days, I just let OSX do it's horribly inefficient thing. Battery life is still stellar.
     
  8. ArmanUV thread starter macrumors member

    Joined:
    Jul 15, 2010
    #8
    For me the problem wasn't the battery life, it was the benefit of a almost completely silent laptop. Plus, now I don't have to worry that much about moving my mbp when it's on, especially considering that the sms sensor doesn't work in this configuration.
     
  9. adrian1480 macrumors 6502

    Joined:
    Sep 2, 2010
    #9
    o i c.

    I didn't put my HDD in the optibay, so for me it's silent whether it's mounted or sleeping or active.

    Glad you found a good solution, though.
     
  10. robots3humans0 macrumors 6502

    Joined:
    Sep 22, 2009
    Location:
    London, Ontario
    #10
    great guide! thanks for the info about not automounting.

    I just wrote some simple scripts that i attached to keyboard shortcuts using BetterTouchTool in order to mount/unmount my optibay HDD (CMD+shift+M/CMD+Shift+E). Works well for me as I don't really need growl notifications. Just hearing the drive unmount and turn off is notification enough :p
     
  11. hover macrumors newbie

    Joined:
    Jul 23, 2007
    #11
    Two questions to those who have successfully applied this method:

    1) When you unmount the partitions, does the drive spin down immediately? In my case it does not: I have to wait for a certain idle period (specified with "sudo pmset -a disk sleep N" in minutes).

    2) When you wake up your sleeping laptop, does it spin up the drive? In my case it does, even if the partitions were unmounted and the drive was stopped prior to sleep.

    This is unfortunate, I hoped one could have a drive that would be normally off.

    It is a mid-2011 15" MBP with OWC SSD in the main bay and 750GB Seagate HDD in the Optibay.
     
  12. robots3humans0 macrumors 6502

    Joined:
    Sep 22, 2009
    Location:
    London, Ontario
    #12
    Mine spins down immediately following unmounting. Although, the script I'm using has EJECT disk rather than UNMOUNT disk in the shell script so maybe that has something to do with it?

    With regards to sleep, yeah mine spins up when I wake it up but running the eject script stops that. And either way, its only a minute until in spins back down.
     
  13. hover macrumors newbie

    Joined:
    Jul 23, 2007
    #13
    robots3humans0: Could you please share the scripts (and other configuration steps) that you used?

    In my case, the battle is far from won, apparently. Some process spins up the drive every 5 minutes at precisely HH:04:30, HH:09:30, HH:14:30 etc.
     
  14. hover macrumors newbie

    Joined:
    Jul 23, 2007
    #14
    "hdiutil eject disk1" indeed, as you said, spins down the drive instantly. After that, however, SpindownHD still shows the drive as active, which confused me.

    The other problem that haunts me is this HH:04:30, HH:09:30 spin-up. It affects ejected drives the same.
     
  15. robots3humans0 macrumors 6502

    Joined:
    Sep 22, 2009
    Location:
    London, Ontario
    #15
    I paired the scripts with Quicksilver to create keyboard shortcuts so its really easy (CMD+Shift+E for eject and CMD+Shift+M for mount). I used the Applescript editor to create scripts that launch as apps and unmount/mount. I read a tutorial on here awhile ago about how to write the eject script and through trial and error wrote an easy mount script. I take no credit for the steps or for the script itself for the eject.

    For the eject script, first open text edit and create a blank document and name it .dummy and through the save window place it onto the root of the optibay drive. Open applescript editor and use this code:

    do shell script "touch /Volumes/Movies/.dummy;
    diskutil eject /dev/disk1"

    Save it as an application and place it wherever you want.

    For the mount script, open applescript editor and use:

    do shell script "diskutil mountDisk /dev/disk1"

    To associate with a keyboard shortcut download Quicksilver from here: http://www.blacktree.com/

    Open the preferences and go into triggers, use the + to add a new action and add it from there.

    With regards to your spinning up problem I'm not really sure what to tell you. Do you have indexing disabled? What about iStat? iStat will turn the drive on ro monitor it from time to time. I've disabled iStat since using the optibay.
     
  16. ArmanUV thread starter macrumors member

    Joined:
    Jul 15, 2010
    #16
    it has been a few months and I have some updates on this issue:
    1. Contrary to what I wrote in the first post about iStat Menu, disabling the disk monitoring functions does NOT prevent this program from spinning up the HD every ~5mins. I have filed a bug report with the developer but for now, I live without it.

    2. One other program which spins up the HD every now and then is Parallels. There is really nothing we users can do about it except complaining to the developers.

    3. Using the 'diskutil eject' command instead of 'diskutil unmountDisk' in the script causes the drive to go to sleep immediately.

    4. Even if the drive is fully ejected, OS X does not spin down the drive when it wakes up from sleep. To workaround this bug, I used Sleepwatcher to execute the eject command whenever OS X wakes up from sleep. I can write up a tutorial if any one is interested.

    5. A simpler (and probabely safer) way of ejecting the drive after a reboot is to drop a bash executable containing the 'diskutil eject UUID' command in login items in system preferences.
     
  17. happle macrumors 6502a

    Joined:
    Jun 20, 2010
    #17
    i may be. I'm still deciding what to do with my hdd in the optibay. mines silent and i can't tell whether its running or not most of the time. that might change when i put a 7200 rpm drive in there though. battery life does seem to be slightly effected.
     
  18. ArmanUV thread starter macrumors member

    Joined:
    Jul 15, 2010
    #18
    I also can't tell whether it's spinning or not without listening to it in a quiet room. The SpindownHD app I mentioned in the first post does not work reliably. Right now though, the combination of sleepwatcher, Alfred extensions and uninstalling iStat Menus keeps my HD quiet.
     
  19. WonkyPanda macrumors regular

    WonkyPanda

    Joined:
    Mar 29, 2010
  20. happle macrumors 6502a

    Joined:
    Jun 20, 2010
    #20
    can't you just download cocktail and set it to sleep disk after a certain amount of time? thats what i do and its a heck of a lot simpler than this.
     
  21. ArmanUV thread starter macrumors member

    Joined:
    Jul 15, 2010
    #21
    If you had read even the first three lines of this thread you'd know why :
     
  22. ZZ Bottom macrumors 6502a

    Joined:
    Apr 14, 2010
    #22
    Would you mind briefly explaining how this is done? I would like the drive to auto-unmount but would prefer it done as a startup process. I am unfamiliar with "bash executables." Also, do I include the quotation marks, and do I replace "UUID" with the exact name of the hard disk? Do I need a / in front? i.e. /320 gb HD

    Thanks
     
  23. had2B macrumors newbie

    Joined:
    Jul 26, 2009
    #23
    This is exactly what I am looking for too, but i need to be walked thru the process.
    Hope someone will come to our rescue! :confused:
     
  24. EvryDayImShufln macrumors 65816

    EvryDayImShufln

    Joined:
    Sep 18, 2006
    #24
    Thanks for the post, very useful! Got my setup running pretty decently following your guidelines.

    The only issues really are that we actually have to eject the drive (using alfred and the applescript) to keep it from spinning up. I really wonder which programs are making it spin up, would anybody know a way to check this (like check application requests for hard drive use?). It's not spotlight, and I've removed iStat.
     
  25. had2B macrumors newbie

    Joined:
    Jul 26, 2009
    #25
    I am indeed interested in this procedure. Having accomplished the ejection of my internal drive at login using some tips i read in this post and elsewhere, i now only need to address the spinup at wake from sleep. It's easy to do manually as i have the eject script sitting in the dock as an app, but automatic would be The Ritz.

    PS iStats Menus was causing my spinup problems after ejection. I simply unchecked the "monitor SMART drive temps" option, and no more spinups.

    ----------

    I read in a post somewhere that Parallels may cause spinups ....???
     

Share This Page