[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-id: <45BD522F.3070706@shaw.ca>
Date: Sun, 28 Jan 2007 19:47:27 -0600
From: Robert Hancock <hancockr@...w.ca>
To: linux-kernel <linux-kernel@...r.kernel.org>,
linux-ide@...r.kernel.org, linux-scsi@...r.kernel.org
Subject: [PATCH RFC] sd: spin down disks on removal or power-down
Here's a patch for sd.c I've cooked up which issues a START STOP UNIT
command to stop the drive when the SCSI disk is removed or the machine
is powered down. The rationale behind this is that apparently on many
drives, simply cutting power to the spinning disk forces it to do an
emergency head park/unload which creates more wear on the drive then a
controlled park/unload with power still applied. This change ensures
that the drive will be spun down if the user shuts down the machine or
if they are about to hot-unplug the drive and have done "scsiadd -r" first.
The main potential concern I have about this implementation is that if
the drive is used in a multi-initiator, iSCSI, etc. environment,
stopping the drive may be undesirable as another initiator may still be
accessing it. I'm not familiar enough with these setups to know if this
problem is likely to come up or not. For this and other reasons we may
want to make this behavior controllable - I'm open to suggestions on how
to do this or whether it's needed.
I've tested that this does work on SATA disks through libata (with my
patch "libata: fix translation for START STOP UNIT" applied). I also
tested with some external USB-to-IDE drive enclosures. The support for
START STOP UNIT on those seems rather poor though, on one enclosure with
a Genesys bridge chip it returned a check condition with "Invalid field
in CDB", and on another with a JMicron chip the request succeeded but it
didn't actually spin the drive down.
--
Robert Hancock Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@...pamshaw.ca
Home Page: http://www.roberthancock.com/
View attachment "sd-stop-unit-on-shutdown.patch" of type "text/plain" (1793 bytes)
Powered by blists - more mailing lists