Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've done some quick Googling but didn't find an answer. I've put an SSD in my Macbook, and at the same time moved the original hard drive to the optical drive bay. I'm running the OS and most of my daily apps off the SDD so the hard drive is really just for storing stuff I need now and then.

Now I'd like to disable (as in power off or "force sleep") the hard drive when I don't need it. Tried unmounting the disk using diskutil unmountDisk but it kept spinning for like 10 minutes. Maybe that's to be expected, but I'd imagined it would stop instantly on unmount. Also, it would be nice to have it disabled by default, and only mount it (= power on) when I need it.

share|improve this question
add comment

11 Answers

up vote 0 down vote accepted

Because Apple doesn't want you to do this... sorry, this bay is basically limited to "DVD" functionalities. So what this means is that it will "act" and control the drive just like a DVD drive and not an hard drive. Macbook's are way more custom than people think... You may also learn at the same time that the power output for this bay is limited and many hard drive's are not supported.

share|improve this answer
    
Ah OK I see... Guess simply unmounting it will have to do then. Off to script the unmount process... Thanks! –  cpak Mar 9 '11 at 10:13
    
I have the same question for Windows 7, is it possible there? –  danny May 21 '11 at 21:09
add comment

I agree with sarfata. A SATA port is a SATA port. It does not make any difference to the OS that it was originally used for DVD.

I have also moved my HDD to the optical bay ($15 bracket via Amazon.com), and installed an SSD in the primary bay of my MacBook Pro Uni-15.

I get a 30% power reduction by setting the HDD to sleep, but it takes three steps:

  1. Enable disk sleep in Energy preferences.

  2. In Terminal:

    sudo pmset -a disksleep 1
    

    (To sleep the disk after only 1 minute.)

  3. Also, to tep it from randomly spinning up, I disabled Spotlight on this drive

    sudo mdutil -i off /Volumes/TSA-Data 
    

    Or the conventional way: drag the drive (all partitions) from the Finder sidebar to the list of places that Spotlight excludes, in the Spotlight Preferences

share|improve this answer
    
This answer is a copy/paste of @sarfata 's one. It doesn't provide more information. –  benweet Apr 14 at 22:08
add comment

I made the following compact script with help from earlier answers. The script mounts and opens the secondary drive (disk1, here "HDD") if it isn't mounted, and ejects it if it is mounted.

I also reduced the the idle time to 1 min (in terminal: sudo pmset -a disksleep 1) and placed "HDD" in the list of Spotlight exceptions where it reappears every time it's mounted.

Then, the disk won't start too often but will go back to rest quickly, when mounted of course. Note also that unmounted disks can start when using e.g. system info and disk utility.


Use the correct disk name instead of "HDD" below!

The script MountHDD.scpt:

tell application "Finder"   
if not (exists the disk "HDD") then   
do shell script "diskutil mountDisk 'disk1'"      
tell application "Finder"                 
activate    
make new Finder window     
set target of Finder window 1 to disk "HDD"    
end tell    
else   
do shell script "diskutil eject 'disk1'"      
end if   
end tell   

Save the script as a program (.app) and place the program in Dock!

Note that the disk still spinns up (unmounted) at boot and wake up. Run the app once/twice (mounted/unmounted) to sleep it. if you do nothing it will spin the idle time (1 min if sudo pmset -a disksleep 1 is used) and then stop.

share|improve this answer
add comment

I do not agree with deijmaster. A SATA port is a SATA port. It does not make any difference to the OS that it's usually used for DVD.

I have also moved my HDD to the optical bay.

The best thing I have found so far to reduce noise is:

  • Make sure that you enable disk sleep in Energy preferences.
  • Then, run in Terminal:

    sudo pmset -a disksleep 1
    

To sleep the disk after only 1 minute.

Also, if you disable Spotlight on this drive, the drive will not spin up when you open Spotlight. To disable spotlight:

sudo mdutil -i off /Volumes/TSA-Data 

(Or the conventional way: drag the drive (all partitions) from the Finder sidebar to the list of places that Spotlight excludes, in the Spotlight Preferences)

It still spins up some times without obvious reason.

share|improve this answer
add comment

My final solution was to create an Automator application which I run from Spotlight.

  • One for ejecting the HD;

    Run Shell Script: diskutil eject 'disk1'

  • Another for mounting the HD;

    Run Shell Script: diskutil mountDisk 'disk1'

Where disk1 is the name of the disk you want to spin down/force to sleep/eject. This name is found in "System Information".

share|improve this answer
add comment

So I also did some of the Googling and found nothing that really helped. After combining some stuff I found running

hdiutil eject disk1

in Terminal to work. If you get info in Disk Utility you can see if the drive you want to eject is disk0 or disk1 or whatever. I find some times the disk will spin back up if I do things like open Disk Utility again.

share|improve this answer
add comment

Here is simple apple script:

set answer to the button returned of (display dialog "Your second HDD wants to?" with icon caution buttons {"Wait", "Sleep", "WakeUp"})

if answer = "Sleep" then
    do shell script "hdiutil eject disk1"
else if answer = "WakeUp" then
    do shell script "diskutil mountDisk disk1"
end if
share|improve this answer
add comment

I found that I also had to run mdutil -d /Volumes/<hard disk> to get it to stop searching the drive as well, since doing a stop on indexing did not prevent it from searching it since it had been indexed once already.

Now I can hit spotlight and the second drive stays spun down.

share|improve this answer
add comment

Format second disk in optic drive as standard Mac OS journaled like a external drive. Then move it into the private section of spotlight. You can also unmount it on disk utility since OS will not be present on that disk which means no terminal. Disk will only spin up when you click on it.

share|improve this answer
add comment

I've made applescripts to both mount and unmount my drive.

Regular HDD in my optical bay. Macbook Pro (late 2006). OSX Lion

Drive spins down and stays that way unless you open disk utility, resume from sleep, or remount the drive. Spotlight doesn't cause the drive to spin up. Neither does trying to access any alias on the drive.


-If there's running processes open that prevent the drive from ejecting, the script opens Activity monitor and runs lsof in a Terminal window.

-You can then decide if the process should be killed.

-A dialog box asks for user confirmation to kill.

I run these from the applescript menu. You can enable it like this:

  1. Open AppleScript Editor.app (Applications -> Utilities).
  2. Open Preferences….
  3. Check "Show Script menu in menu bar".

Mount drive

on run
    try

        do shell script "diskutil mountDisk disk1"

    on error

    end try
end run

Unmount drive

on run

    try

        do shell script "hdiutil eject disk1"

    on error

        tell application "System Events"
            set termOpen to count (processes whose name is "Terminal")
            set amOpen to count (processes whose name is "Activity Monitor")
        end tell


        tell application "Terminal"
            activate
            set newTab to do script "lsof /Volumes/'HFS HD'"
        end tell

        tell application "Activity Monitor"
            activate
        end tell

        delay 3

        set question to display dialog "Kill running?" buttons {"Yes", "No"} default button 2
        set answer to button returned of question

        if answer is equal to "Yes" then
            do shell script "lsof -P | grep '/Volumes/HFS HD'  | awk '{print $2}' | xargs kill -9"
            do shell script "hdiutil eject disk1"
        end if


        tell application "Activity Monitor"
            if amOpen is 0 then
                quit
            end if
        end tell

        tell application "Terminal"
            if termOpen is 0 then
                quit
            else
                close (first window whose selected tab is newTab) saving no
            end if
        end tell



    end try
end run

Works perfect for me, hopefully you also have success!

share|improve this answer
add comment

As for other posters, this worked for me.

  • I run the commands in Terminal when I want
  • I did not have to disable Spotlight in any way
  • I can instantly spotlight the drive once it is mounted

I will try some of the suggestions on automating it or simplifying it.

// unmount
hdiutil eject disk1

// mount
diskutil mountDisk disk1

Setup: MacbookPro 7,1 13 inches with Mountain Lion 10.8.3. The secondary hard drive in place of the dvd drive, the main drive being a SSD

share|improve this answer
add comment

protected by slhck Dec 31 '13 at 16:36

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.