Summary: Re: Spin down HDD after disk sync or before power off

Warren Block wblock at wonkity.com
Sat Mar 6 00:28:54 UTC 2010


Just wanted to followup with a summary before all vestiges of what I 
learned evaporate from my memory.  My apologies for the lateness.

1. Existing FreeBSD ata-disk code does not explicitly park the hard 
drive heads on shutdown.  So the power loss causes an emergency park, 
which sounds bad and is bad for the heads.

2. There are a limited number of powerup/powerdown or maybe 
spinup/spindown cycles for a drive.  Not sure what causes the wear.

3. FreeBSD doesn't park heads at reboot, either, but that's good because 
of #2.

4. FreeBSD's suspend code does call STANDBY_IMMEDIATE to park heads.

5. I couldn't tell if the STANDBY_IMMEDIATE in a reboot actually spun 
the drive down.  It may be that the hardware reset happens so quickly 
after the standby that it doesn't matter.  Or maybe it brakes very 
quietly.  Possibly different brands do different things.  I can think of 
ways to check, like measuring motor current, but don't have the 
equipment to try that.

6. Ond?ej Majerech suggested checking NetBSD's method of spinning the 
drive down.  I did, and they have a direct way of telling the difference 
between reboot and shutdown, somewhat differently from FreeBSD.

7. I actually waded hip-deep through magic C code and made a powerdown 
event handler for ata-disk.c.  It compiled and even seemed to work, 
although I don't trust it.

8. Alexander Motin has an updated CAM version of the ATA system which 
will eventually replace the existing one.  In -CURRENT, anyway.  He was 
kind enough to look at my event handler.  My understanding is that he is 
looking at implementing the head parking/standby mechanism in that new 
code.

Conclusions:

If you rarely power down a system with FreeBSD, it may not matter, and 
reboots with the existing code should not be a problem.

If you power down a system from FreeBSD often, the patch in 
http://docs.freebsd.org/cgi/getmsg.cgi?fetch=233916+0+archive/2010/freebsd-hackers/20100131.freebsd-hackers 
is still the lowest-impact version, although it calls STANDBY_IMMEDIATE 
for both reboot and shutdown.

I don't have evidence either way as to whether the standby followed by a 
reboot causes as much wear as a cold spinup/spindown cycle, or whether 
that is more of a problem than emergency head parks.

-Warren Block * Rapid City, South Dakota USA


More information about the freebsd-hackers mailing list