Spin down HDD after disk sync or before power off

Warren Block wblock at wonkity.com
Fri Jan 29 22:38:54 UTC 2010


On Wed, 27 Jan 2010, Alexander Best wrote:

> i believe the sound you hear is due to the emergency unload sequence. i'm not
> 100% sure, but i think after applying the patch the sound is gone. i recently
> replaced my old IDE hdd (which made a very loud "click!" during shutdown) with
> a new SATA hdd. the new one is very quiet and so it's not that easy to
> recognise any changes in the spin down procedure.
>
> would be very nice if you could try the patch on one of the notebooks you're
> referring to in order to see if the patch makes a difference.

Based on followups to this thread, here's the modified patch I've 
tested:

--- sys/dev/ata/ata-disk.c.orig	2010-01-28 10:47:57.000000000 -0700
+++ sys/dev/ata/ata-disk.c	2010-01-28 11:49:32.000000000 -0700
@@ -191,6 +191,10 @@
  {
      struct ata_device *atadev = device_get_softc(dev);

+    if (atadev->param.support.command2 & ATA_SUPPORT_POWERMGT)
+	ata_controlcmd(dev, ATA_STANDBY_IMMEDIATE, 0, 0, 0);
+    return 0;
+
      if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE)
  	ata_controlcmd(dev, ATA_FLUSHCACHE, 0, 0, 0);
      return 0;

This uses the POWERMGT bit and adds it before the existing code.

On a desktop system with an 80G drive, it's hard to tell if there's an 
audible difference.

On an Acer notebook with a WD drive, it does change the sound.

Without the patch, the drive shutdown sounds like power has been pulled, 
with a GLINK! head park followed by a decreasing-pitch spindown whir.

With the patch, there's a quieter glink with nearly no spindown whir.

Because this is subjective, I recorded the shutdown sounds with a 
microphone underneath the notebook hard drive:

http://wonkity.com/~wblock/sounds/unpatchedglink.wav
http://wonkity.com/~wblock/sounds/patchedglink.wav

Can't speak to the safety of this, but it definitely sounds better.

-Warren Block * Rapid City, South Dakota USA


More information about the freebsd-hackers mailing list