Spin down HDD after disk sync or before power off

Oliver Fromme olli at lurza.secnetix.de
Wed Jan 27 12:35:15 UTC 2010

Alexander Best <alexbestms at wwu.de> wrote:
 > because of kern/140752 i looked through a discussion back in 2009
 > (http://lists.freebsd.org/pipermail/freebsd-hackers/2009-March/027879.html)
 > concerning freebsd's hdd spin down procedure. right now ATA_FLUSHCACHE is
 > being used although the hitachi hdd specs referenced in the pr say that this
 > will not cause proper load/unload and thus an emergency unload will occur
 > which reduces the life expectancy of hdds dramatically (20.000 shutdowns vs.
 > 600.000 shutdowns). unfortunately the discussion back then didn't come up with
 > any sort of decision/patch.
 > attached you'll find a very simple patch which issues ATA_STANDBY_IMMEDIATE
 > instead of ATA_FLUSHCACHE during hdd spin down.

A few comments ...

First, you should not *replace* ATA_FLUSHCACHE.  Rather, you
should issue *both* commands, first ATA_FLUSHCACHE and then
ATA_STANDBY_IMMEDIATE (maybe with a short delay between, just
to be on the safe side).

Second, you should make sure that ATA_STANDBY_IMMEDIATE is
only used when a poweroff is requested, but not in other
cases.  Of course, ATA_FLUSHCACHE should *always* be sent.

Finally, it would be nice if it is put under a sysctl or
similar, so the feature can be switched on and off.

Best regards

Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

"Above all, they contribute to the genetic diversity in the
operating system pool.  Which is a good thing."
  -- Ruben van Staveren, on the question which BSD OS is the best one.

More information about the freebsd-hackers mailing list