Hot Swap Disks

Keith Lofstrom keithl at kl-ic.com
Tue Jan 20 16:51:37 UTC 2004


                                                                                
John Sutherland <fedora at sneeu.com> writes:
> Is there anyway to turn off an IDE hard disk for hot swapping?

Yes there is, but it is a bit of a kludge until a bug gets fixed.
Alan Cox and others have written code that permits this, and the
code is in the FC1 kernel.

In theory, all you need to do is:

   unmount /dev/hdXXX      # for all the partitions
   hdparm -b 0 /dev/hdX    # for the whole drive

   # power down drive, swap, power up

   hdparm -b 1 /dev/hdX    
   mount /dev/hdXXX  /mntpoint  # for all the partitions

The "hdparm -b 0" command tristates the IDE controller lines so you
can remove the drive without damaging the hardware.   Of course, the
drives should be in caddies so that the powerdown occurs properly.
I like the Vipower cages for this.
   
*** HOWEVER ***, there seems to be a bug in the process somewhere 
(see bugzilla.redhat.com #113693) that fails to upgrade the geometry
tables for the drive.  So, I end up doing this to restart the new drive:

   hdparm -b 1 /dev/hdX    
   sfdisk /dev/hdX     <control C>  # !!!
   mount /dev/hdXXX  /mntpoint  # for all the partitions

sfdisk seems to know enough to diddle the tables.  This is risky,
though;  one wrong character typed into sfdisk and the drive is 
repartitioned.  I would sure like a better technique, or else have
the bug fixed.

That said, I have done this dozens of times as part of my drive-to-drive
backup scheme ( http://www.keithl.com/linuxbackup.html ) so if you are
careful it should work until the bug gets fixed.

Keith

-- 
Keith Lofstrom           keithl at ieee.org         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 fedora-list mailing list