From owner-freebsd-hackers@FreeBSD.ORG Sat Mar 6 00:28:54 2010 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 7BBC0106567C; Sat, 6 Mar 2010 00:28:54 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) by mx1.freebsd.org (Postfix) with ESMTP id 063D38FC13; Sat, 6 Mar 2010 00:28:53 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.3/8.14.3) with ESMTP id o260Sqpl002715; Fri, 5 Mar 2010 17:28:52 -0700 (MST) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.3/8.14.3/Submit) with ESMTP id o260So3Q002712; Fri, 5 Mar 2010 17:28:52 -0700 (MST) (envelope-from wblock@wonkity.com) Date: Fri, 5 Mar 2010 17:28:50 -0700 (MST) From: Warren Block To: Oliver Fromme In-Reply-To: <201002041246.o14CkK39012628@lurza.secnetix.de> Message-ID: References: <201002041246.o14CkK39012628@lurza.secnetix.de> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3 (wonkity.com [127.0.0.1]); Fri, 05 Mar 2010 17:28:53 -0700 (MST) Cc: freebsd-hackers@FreeBSD.ORG, jkim@FreeBSD.ORG, alexbestms@wwu.de Subject: Summary: 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: Sat, 06 Mar 2010 00:28:54 -0000 Just wanted to followup with a summary before all vestiges of what I learned evaporate from my memory. My apologies for the lateness. 1. Existing FreeBSD ata-disk code does not explicitly park the hard drive heads on shutdown. So the power loss causes an emergency park, which sounds bad and is bad for the heads. 2. There are a limited number of powerup/powerdown or maybe spinup/spindown cycles for a drive. Not sure what causes the wear. 3. FreeBSD doesn't park heads at reboot, either, but that's good because of #2. 4. FreeBSD's suspend code does call STANDBY_IMMEDIATE to park heads. 5. I couldn't tell if the STANDBY_IMMEDIATE in a reboot actually spun the drive down. It may be that the hardware reset happens so quickly after the standby that it doesn't matter. Or maybe it brakes very quietly. Possibly different brands do different things. I can think of ways to check, like measuring motor current, but don't have the equipment to try that. 6. Ond?ej Majerech suggested checking NetBSD's method of spinning the drive down. I did, and they have a direct way of telling the difference between reboot and shutdown, somewhat differently from FreeBSD. 7. I actually waded hip-deep through magic C code and made a powerdown event handler for ata-disk.c. It compiled and even seemed to work, although I don't trust it. 8. Alexander Motin has an updated CAM version of the ATA system which will eventually replace the existing one. In -CURRENT, anyway. He was kind enough to look at my event handler. My understanding is that he is looking at implementing the head parking/standby mechanism in that new code. Conclusions: If you rarely power down a system with FreeBSD, it may not matter, and reboots with the existing code should not be a problem. If you power down a system from FreeBSD often, the patch in http://docs.freebsd.org/cgi/getmsg.cgi?fetch=233916+0+archive/2010/freebsd-hackers/20100131.freebsd-hackers is still the lowest-impact version, although it calls STANDBY_IMMEDIATE for both reboot and shutdown. I don't have evidence either way as to whether the standby followed by a reboot causes as much wear as a cold spinup/spindown cycle, or whether that is more of a problem than emergency head parks. -Warren Block * Rapid City, South Dakota USA