Spin down HDD after disk sync or before power off

Octavian Covalschi octavian.covalschi at gmail.com
Wed Mar 4 13:17:54 PST 2009


Thank you for detailed and clear answer!

On Wed, Mar 4, 2009 at 1:38 PM, Oliver Fromme <olli at lurza.secnetix.de>wrote:

> Octavian Covalschi wrote:
>  > I'm looking a way to spin down HDD just right before power off. Why?
>  >
>  > Because currently when I call "shutdown -p now", HDD is powered off at
> it's
>  > full speed (7200.4) and as a result
>  > I hear a noise of stopping/spinning down of HDD, and _this_ concerns me
> as
>  > I'm afraid it can damage HDD.
>
> You don't have to spin down a disk before powering it off.
> The noise you hear is probably caused by the "autopark"
> feature of the drive.  It is harmless.
>
>  > I've tried to use rc.shutdown, but the sync of disks "wakes" HDD
> again...
>
> Of course, upon halt or reboot the kernel will sync all
> file systems that have been mounted read+write.
>
>  > While searching for a solution, I noticed that reboot command/app _does_
>  > spin down hdd right before it resets system power,
>  > I can hear how HDD is powered on after that...
>
> No, the reboot command doesn't do that.  It's probably your
> BIOS that resets the devices.
>
>  > 2nd thing is I cannot find "halt.c" file, i wanted to take a look how it
>  > does it... although I'm up to date it's not not in
>  > /usr/src/sbin
>
> halt(8) is a hardlink to reboot(8).
> Look at src/sbin/reboot.
>
> By the way, the syncing does not happen in halt(8).  At the
> time the kernel syncs the disks, no processes are running
> anymore, not even init(8).  You can't do anything from
> userland at this point.  If you want to insert a spin-down
> for your disks, you will have to modify the kernel.  You
> have to install an event handler for "shutdown_post_sync".
> See the boot() function in src/sys/kern/kern_shutdown.c
> for details about the kernel's shutdown sequence.
>
> 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
>
> "Python is an experiment in how much freedom programmers need.
> Too much freedom and nobody can read another's code; too little
> and expressiveness is endangered."
>        -- Guido van Rossum
>


More information about the freebsd-hackers mailing list