Disable or sleep secondary hard drive in Macbook

Solution 1:

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.

Solution 2:

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.

Solution 3:

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.

Solution 4:

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".

Solution 5:

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