Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Mar 2009 14:50:45 -0600
From:      Octavian Covalschi <octavian.covalschi@gmail.com>
To:        freebsd-hackers@freebsd.org, octavian.covalschi@gmail.com
Subject:   Re: Spin down HDD after disk sync or before power off
Message-ID:  <c0f49ea0903041250l252f16ads25b735b7bf4c533c@mail.gmail.com>
In-Reply-To: <200903041938.n24Jcqdr060153@lurza.secnetix.de>
References:  <c0f49ea0903040910w496f4a72m3c3ce6882e55c307@mail.gmail.com> <200903041938.n24Jcqdr060153@lurza.secnetix.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Thank you for detailed and clear answer!

On Wed, Mar 4, 2009 at 1:38 PM, Oliver Fromme <olli@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 m=
e
> 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 _doe=
s_
>  > 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=E4ftsfuehrun=
g:
> secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht M=FC=
n-
> chen, HRB 125758,  Gesch=E4ftsf=FChrer: Maik Bachmann, Olaf Erb, Ralf Geb=
hart
>
> 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
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?c0f49ea0903041250l252f16ads25b735b7bf4c533c>