[PLUG] IDE swap tray info

Keith Lofstrom keithl at kl-ic.com
Tue Jan 4 20:45:02 UTC 2005


Bryan Murdock writes:

> I feel dumb asking this, but, I bought a cheap IDE removeable drive tray
> from Fry's today without thinking too much about it.  This is for my home
> computer, I just want to be able to swap a second hard drive in and out, for
> backups and stuff.  There's no way this would be hot swap-able, right?  I
> mean, I'm thinking in Linux I could just unmount it, turn the key (which
> turns of the power) and slide it right out, but something tells me that
> probably isn't going to work.  Does anyone know for sure?
                                                                                
> Bryan

Bryan:  Not a dumb question at all.  Only the subject line "dumb
hardware question" was dumb (irrelevant and insufficent information),
but then, you warned us.  In the future, skip the self-deprecation,
(you are no dummy, you are here, aren't you?) concentrate on "direct
and informative".  On to your question ...

IDE hotswap is indeed possible, but only with the later 2.4.X series
of kernels.  Alan Cox put code in there to permit live hotswap of IDE
drives;  the 2.5.X and 2.6.X kernel folk took it back out again.  I
think they did it to impress Jodie Foster.

With a 2.4.X kernel from late 2003 or 2004, such as RH9 or Fedora Core 1
(not 2 or 3!) you can do this:

   umount /dev/hde   (for example)
   hdparm  -b 0 /dev/hde
   (turn key, pull drive, insert drive, turn key)
   hdparm -zb 1 /dev/hde
   mount  /dev/hde  /mnt/tempdrive

The "hdparm" instruction tristates the bus that the drive is on, to
protect it from damage.  You should only have one drive on the cable.  
The "z" for the re-attach is important, it tells the kernel to rebuild
the drive parameter table, which is otherwise left over from the previous
drive.

The kernel developers will probably remain fixated on Jodie Foster, or
the little voices in their heads, rather than users or Alan Cox, so
don't count on this being fixed in 2.6.X any time soon.  Meanwhile, a
more modern way to do this is to follow wamorita's suggestion and use
a USB2 enclosure, where hot swap is supported.  The problem with the
USB2 approach is that a significant number of the chipsets are not
properly supported by the kernel, and external drives will hang for
minutes in the middle of transfers.  Two known-bad enclosures are the
Maxtor USB2 enclosure, and the Sanmax InClose USB2 enclosures at Fry's.
A known-good enclosure is the ViPower, which unfortunately is a little
hard to find;  you may find it at ENU, or you may have to mail-order
some of these.  Go for the slide switch rather than the key switch!

I gave a talk on using swappable hard drives for backups at the March
2004 PLUG meeting;  I will be presenting an updated version of that
talk to PANUG later this month, and to the Oregon IEEE Consultant's
Network (members.eeconsult.org).  Some of the information can be found
at www.keithl.com/linuxbackup.html, and some can be found in a three
part article about dirvish, starting with the January 2005 Sys Admin
magazine, available at Powell's Technical and other places.

I hope that answers your question in effusive detail.  Note the change
in subject line - my answer will be in the PLUG email archives forever,
and I want other Googlers to be able to find it!

Keith

-- 
Keith Lofstrom          keithl at keithl.com         Voice (503)-520-1993
KLIC --- Keith Lofstrom Integrated Circuits --- "Your Ideas in Silicon"
Design Contracting in Bipolar and CMOS - Analog, Digital, and Scan ICs



More information about the PLUG mailing list