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

Oliver Fromme olli at lurza.secnetix.de
Thu Sep 16 14:10:42 UTC 2010


Tijl Coosemans wrote:
 > On Thursday 16 September 2010 10:41:07 Oliver Fromme wrote:
 > > Also, there are cases where it is completely impossible to
 > > decide automatically whether the disks should be spun down
 > > or not.  For example, if the admin issues a shutdown -h
 > > (halt), there's no way for the OS to know in advance whether
 > > the admin is going to switch the machine off or reboot to
 > > multi-user.  So there must be a way for the user to forcibly
 > > enable/disable the spindown feature.  I think a sysctl is
 > > the most appropriate way to do that, isn't it?
 > 
 > I would just spin down the disk in case of a halt. An unwanted spin
 > down is harmless compared to an emergency shutdown and usually the
 > intention is to power off rather than reboot.

Is it?  When I intend to power-off, I use shutdown -p, not
shutdown -h.  Quite often (but not always) when I halt a
machine, I'm going to reboot to multi-user, not power off.

In that case I certainly wouldn't want to spin the drives
down and have them spun up immediately afterwards.  I don't
think that wear&tear caused by that procedure is completely
insignificant (although it's certainly less of a problem
than emergency unloads).

For that reason I definitely want to have a way to disable
the spindown function manually.

 > Part of your patch modifies ada_shutdown. That function already gets
 > the reboot(2) howto flags passed to it, so you could test for
 > (howto & (RB_HALT | RB_POWEROFF)) != 0 before issuing the STANDBY
 > command.

Right, good point.  I didn't notice because the shutdown
function in ad(4) doesn't get the howto flag, so I assumed
(without checking) that ada(4) doesn't get it either.

 > There's no need to make this more complicated with a sysctl
 > that can override this in my opinion.

I'm afraid I have to disagree (see above).  Apart from that,
there's nothing complicated at all about a sysctl.

 > Also command2 should be command1 in this line:
 > 
 > +       if (cgd->ident_data.support.command2 & ATA_SUPPORT_POWERMGT)

Oops ...  You're right.  Thanks for pointing that out.

Best regards
   Oliver

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

"I made up the term 'object-oriented', and I can tell you
I didn't have C++ in mind."
        -- Alan Kay, OOPSLA '97


More information about the freebsd-hackers mailing list