# camcontrol standby turning off HDD immediately



## aragon (Dec 30, 2009)

Hi

I use camcontrol(8) to set a standby timeout for my HDD to spindown after a certain time of inactivity.  However, when I run the command to set the timeout the hard drive spins down immediately.  Based on the source it doesn't look like this should be happening.  Does anyone know why it is?

Prior to this I was using ata(4) and atacontrol(8)'s spindown feature which didn't spin the drive down immediately.  I've since switched to ahci(4) for the performance gains.


----------



## crsd (Dec 30, 2009)

Same here with 9.0-CURRENT r201182 and <WDC WD7501AALS-00J7B0 05.00K05>   at scbus2 target 0 lun 0 (pass1,ada0). `# camcontrol standby ada0 -t 60` spins down the drive immediately.


----------



## crsd (Dec 30, 2009)

Looks like there's black magick involved.
http://lists.freebsd.org/pipermail/freebsd-stable/2009-November/052997.html:

```
Denis Shaposhnikov wrote:
> I'm trying to replace sysutils/ataidle which doesn't work with new
> acpi(4). May be somebody could tell me args for
> 
>   camcontrol cmd ada0 -a cmd XX XX XX XX XX XX XX XX
> 
> to disable APM and acoustic management (AAM) for my HDD?

To set APM level:
camcontrol cmd ada0 -a "EF 05 00 00 00 00 00 00 00 00 xx 00"
To disable it:
camcontrol cmd ada0 -a "EF 85 00 00 00 00 00 00 00 00 00 00

To set AAM level:
camcontrol cmd ada0 -a "EF 42 00 00 00 00 00 00 00 00 xx 00"
To disable it:
camcontrol cmd ada0 -a "EF C2 00 00 00 00 00 00 00 00 00 00

You can check result with:
camcontrol identify ada0

-- 
Alexander Motin
```


----------



## aragon (Dec 30, 2009)

Nice find.  I'm not sure what AAM is good for, but with APM it seems as though the drive decides when to spin down.  With APM levels below 0x80 on my drive this happens after 30 seconds of inactivity.  Levels at or above that disable spin down and don't seem to do much else except increase average current draw by a few milliamps.

I'm guessing with camcontrol's standby command the cam layer decides when to spin the drive down, but still it shouldn't spin down immediately when setting a timeout.  Anyhow, I'll use the black magic APM command for now.


----------

