Slashdot Mirror


Swapping IDE Drives in Linux without Rebooting?

Hasufin writes "I've got quite a few of those removable IDE drive bays in my computers. I'd like to be able to swap these drives without the need of rebooting linux. I've searched quite a bit via google and other resources but haven't found a good how-to. Any pointers? I've seen few mentions to hdparm -U & -R and a script or two, but haven't had any luck using it w/ my promise udma/66 & udma/100 offboard pci controllers... :\ Any help appreciated!"

25 of 77 comments (clear)

  1. Re:power? by larien · · Score: 4, Informative

    You do get hotswap IDE now, but obviously the OS needs to support it. As most modern OSs don't actually use the BIOS for disk accesses (past the kernel booting), the BIOS is a non-issue.

  2. Check LKML by gantzm · · Score: 2, Informative

    This is being discussed on the LKML right now!

    --


    Excessive forking causes un-wanted children.
    1. Re:Check LKML by Anonymous Coward · · Score: 4, Informative

      Here is the start of the thread, and here is the complete listing of the thread (scroll down to "IDE and hot-swap disk caddies").

  3. Re:power? by larien · · Score: 3, Informative
    I'm not particularly au fait with this, but I'd imagine that the kernel finds the hd controller on the PCI bus and 'walks' the IDE bus looking for the information and probes the drive for info.

    'course, I could be wrong, but I'd imagine some of the comments in the linux kernel code might provide some hints as to how it finds the information.

  4. Re:power? by dfreed · · Score: 2, Insightful

    If disk gometry is the only reason that the HD can not be swapped, then assuming that you have a budget, but 2 or more identical drives to swap. That way the disk is physicaly the same and all you end up changing is the contents.

  5. Try this... by PoiBoy · · Score: 5, Informative
    I've never swapped an IDE hard drive, but I have hot-swapped IDE CD-ROM's out of shear laziness.

    Just be sure to unmount the drive first and disconnect the power cable. Then disconnect the IDE ribbon. Reverse the process with the new drive, then mount it.

    If you've already got a couple of drives without mission critical data on them, you could try this. I doubt if it would damage the drives as long as you're careful. I'm not sure how Linux gets the drive's parameters, but I would guess that it can get them during the mounting, perhaps with a few command-line options if needed.

    --
    Sig (appended to the end of comments you post, 120 chars)
    1. Re:Try this... by Anonymous Coward · · Score: 2, Informative

      Backwards. Pull the data cable THEN the power cable. As per one of Andre's posts, some drives will suck power down the data cable, ruining controller and host, if you pull the molex out first.

    2. Re:Try this... by omega9 · · Score: 2

      And yes, not hot-swapping at all is the true answer.

      No kidding. Read this thread and tell and tell me how confident it would make anyone trying to hotswap IDE.

      --
      I'm against picketing, but I don't know how to show it.
    3. Re:Try this... by inburito · · Score: 2

      Actually promise's controllers are protected against this. So if you have your drive attached to an additional ide-controller card, more than likely the data lines are buffered.

      This is a sure way to fry an onboard ide-controller, however.

    4. Re:Try this... by omega9 · · Score: 2

      You can nix USB off the bat, as transfer rates are far to slow. Firewire I may not trust enough as most of that subsystem is still in development.

      It's all about tradeoffs.

      --
      I'm against picketing, but I don't know how to show it.
    5. Re:Try this... by omega9 · · Score: 2

      Yes, that's fast, but that is a sustained transfer rate. What you have to pay attention to, though, is access times. How fast can it perform random read/wite I/O in small bursts?

      Granted, it is vastly improved over USB 1.0, USB has caught up with IEEE1394, and there are IEEE1394 HDD's. But I still don't think they're worth holding anything other then "dumb data", things like video, mp3, etc... .

      *BUT*, if being hot-swappable is worth a drop in access times, then I agree that this would be a good fix.

      --
      I'm against picketing, but I don't know how to show it.
  6. hot-swapping by mosch · · Score: 5, Funny

    I've had great luck with hot-swappable drives! The trick is to take your IDE devices and run over them with a large vehicle. Now make an emergency requisition of SCSI or FibreChannel devices, and all will work exactly as you were hoping.

  7. The correct procedure... by Wakko+Warner · · Score: 5, Informative

    ...is to buy a SCSI RAID card and a hot swap SCSI enclosure.

    If you try this kind of shit with IDE, prepare for Deep Hurting.

    Sometimes (and I know this is going to really upset a lot of slashdroids) you need to spend money to get certain features.

    - A.P.

    --
    "Remember when the U.S. had a drug problem, and then we declared a War On Drugs, and now you can't buy drugs anymore?"
  8. From lkml by OrenWolf · · Score: 4, Informative

    "read a recent man page for hdparm and you will see kernel allows remove/add ide interface. scripts with correct parameter usage are in contrib directory of hdparm source. IDE maintainer has code to electrically turn off (tristate) ide channels on most PC ide chips, but is waiting to demonstrate at an industry conference before releasing to public." -- Jeremy Jackson

  9. Warning! by afidel · · Score: 4, Informative

    Most IDE drive trays are NOT rated for hot swap, and neither are the controllers on the motherboard. To do ide hotswap the best way is an ide raid controller from either 3ware, Promise or Adaptec along with certified disk trays.

    --
    There are 4 boxes to use in the defense of liberty: soap, ballot, jury, ammo. Use in that order. Starting now.
    1. Re:Warning! by pmsr · · Score: 2, Informative

      3ware controllers worked best for me, been using them for two years now. With the 3ware 3DM software you can add and remove disks, and rebuild the array(s) at will, even with standard disk trays. Just make sure the trays you use really cut the power to the disk when your turn the key to pull the drawer. Some drawers don't do that. Also, some drawers with included fans seem to have a issue where they suck too much power from the drive electronics, and under stress may have problems. To solve it, i removed those fans making sure the air flow inside the machine was optimum. At $99 for a 3ware escalade 6400 (4 ports), with real hardware RAID5 and supporting the latest ATA drivers, they are a complete steal.

      /Pedro

    2. Re:Warning! by unitron · · Score: 2

      As long as you're hot-swapping the drives and not the drive bays, why not run a separate power feed to the fan on the drive bay?

      --

      I see even classic Slashdot is now pretty much unusable on dial up anymore.

  10. IDE Enclosures that claim "hot swap" by sid+crimson · · Score: 2, Informative

    I haven't tried any of these enclosures, but there are some out there that claim IDE-Hot-Swap.

    See this Rackmountpro example.

    -sid

  11. swaping the OS or just a mount? by josepha48 · · Score: 2
    If you are talking about swaping out a mount drive you should be able to do that, by just umounting the drive. You'll have to shut off the services and programs that are using that drive.

    If you are talking about swaping out a drive that is running your OS I'd say forget it. I don't think most IDE are made for that.

    --

    Only 'flamers' flame!

  12. IDE isn't, but Firewire is... by GreenKiwi · · Score: 2, Interesting

    You can get IDE to ieee1394 (firewire) adapters that plug into the back of your hard drive. Now, you just get a nice firewire controller and you have a hot swapable device.

    I think that the last time I checked, these controllers were around $40-50... And firewire's very cool.

  13. A "spin down" command for IDE? or even for SCSI? by Nonesuch · · Score: 2
    With FC-AL drives (at least on modern Sun systems) there is a command to 'spin down' and disconnect a drive in preparation for hot-swap.

    Does any such command exist for standard EIDE controllers/drives? Or even in any standard Unix (preferably FreeBSD) SCSI drivers for non-FCAL drives?

    Without a spin-down and disconnect, hot-swap seems like it must pose some risk, however slight.

  14. Floppy Drives by AnimeFreak · · Score: 2

    A while back, I had to disconnect my floppy drive to do some work inside the case. Now the system is bak up and running, but guess what? I have the ribbon cable connected to the floppy drive but the power cable is not.

    Is it safe to just plug it in or do I need to power-down the system? Powering-down is a last-resort seeing the system is a server.

    1. Re:Floppy Drives by toast0 · · Score: 2

      do you need the floppy drive to have power?

      unless you have an urgent need for it, i'd leave it disconnected, but put a note on the front, and maybe one on the os too.. that lets anybody who would be shutting it down or rebooting it know, that while its down, they may as well hook up the floppy power cable

  15. Re:A "spin down" command for IDE? or even for SCSI by leiz · · Score: 2

    yes, it's possible to shutdown an ide hard drive, although I have never tried it... see the hdparm man page:

    -Y Force an IDE drive to immediately enter the lowest power consumption sleep mode, causing it to shut down completely. A hard or soft reset is required before the drive can be accessed again (the Linux IDE driver will automatically handle issuing a reset if/when needed). The current power mode status can be checked using the -C flag.

  16. Use 1394 or USB 2.0 by iankerickson · · Score: 3, Informative

    If you use an external 1394/Firewire/iLink or USB hard disk, it's just an ATA disk inside. Both 1394 and USB support hot-plugging, and linux support (at least for generic devices like ATA disks) is fairly mature. As for performance, 1394 is supposedly 400 Mb (bits) per second and USB 2.0 is 480 Mb/s. You need to buy a USB 2.0 PCI card for your PC, but they aren't too much. USB 2.0 controllers are also called "EHCI". USB 2.0 devices work with USB 1.1 controllers at the standard 12 Mb/s. Search the web for "USB ATA enclosure" or "Firewire ATA enclosure" and you should find something. For portable disks, you're more likely to find USB ports on a PC, and I suspect 1394 devices are going to seem really overpriced compared to USB 2.0. But YMMV.

    http://www.linux-usb.org
    (you're on your own for 1394)

    I know you spent money on those removable ATA caddies, but if all you want is a hot-swap ATA disk, there are other ways of getting there that are designed to do what you're after.

    --
    Democracy. Whiskey. Sexy. Pick any two.