From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 4 21:17:54 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DD12106566C for ; Wed, 4 Mar 2009 21:17:54 +0000 (UTC) (envelope-from octavian.covalschi@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.237]) by mx1.freebsd.org (Postfix) with ESMTP id 6DB848FC0A for ; Wed, 4 Mar 2009 21:17:54 +0000 (UTC) (envelope-from octavian.covalschi@gmail.com) Received: by rv-out-0506.google.com with SMTP id f6so4002843rvb.43 for ; Wed, 04 Mar 2009 13:17:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=hgSXtNqcpkVCG1TGhFYcwfvftXOyabEkoYIkHV4IvSM=; b=GflNMJ+5B6HScjrek9F/HFacAO69ggiqidNQ9/hbm0jad3yJ8vWh5pUaEEpthf34Jh uQBlB1MZrS8uwxcpYPGcblqhtMUzo8vd5NzcmkKJHX8xGYnVCIBHUYzrbj8A5/hE6P38 FvENP1bV+bl8EVdbjjtt2MlY39dYXbalo3u6Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=RpdjtByNcW0/nI6eVya/SSLZc4keQBkmKpiyjQ52ZLEgjdiwYnTvozsU5+8SEbZvWq tW94e/zt1yO6jC823fik7HbGfsLdMOkArgX7LWZAzlg1ZPgq0hzwE2FqZAU9npJyECGC FktLDi5fpw0sS77Kp22C4alYBOxLUPiBQ14I0= MIME-Version: 1.0 Received: by 10.142.177.5 with SMTP id z5mr115021wfe.90.1236199845341; Wed, 04 Mar 2009 12:50:45 -0800 (PST) In-Reply-To: <200903041938.n24Jcqdr060153@lurza.secnetix.de> References: <200903041938.n24Jcqdr060153@lurza.secnetix.de> Date: Wed, 4 Mar 2009 14:50:45 -0600 Message-ID: From: Octavian Covalschi To: freebsd-hackers@freebsd.org, octavian.covalschi@gmail.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Re: Spin down HDD after disk sync or before power off X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2009 21:17:54 -0000 Thank you for detailed and clear answer! On Wed, Mar 4, 2009 at 1:38 PM, Oliver Fromme 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 >