Blog Post

Non-RAID Hot Swapping Help Needed

OK, since the lazyweb totally owned in helping me locate a killer portable media device, I can use your help once again.

I have Googled and Googled until my eyes have exploded, and I have yet to find the answer I am looking for.

The question….Can you hot swap, not warm swap, SATA drives in Linux without having them a) setup in RAID, and b) not using a hardware RAID controller card? Someone told me that you can and the kernel works out of the box that way. Well, whoever told me was wrong. I have tried it in Red Hat, CentOS, Ubuntu, and SUSE. No go, the kernel panics and blows up and I have to call the Chicago Fire Department ๐Ÿ™‚

Warm swapping works just fine, where I unmount the drive, pull the drive, put in a new drive, configure drive, and then mount the drive. That works, but when a drive fails that isn’t on a RAID controller, or is on one, and isn’t configured with RAID, I want to a) know about it, and b) pull it out without unmounting and what not first.

So, I know there are some of you wizards out there that can help me, so please, any information you may have or questions, please comment or feel free to email me directly (nixternal kubuntu org). Thanks!

This entry was posted in Development, Linux and tagged . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.
  • troll

    Such kernel option indeed exists, but I think it changes only behaviour of the general interface driver for sata/scsi. It does not help you with mounting and such things. I guess what is hot swapping for the kernel developers isn’t quite what you think it is.

    Why on earth would you attempt anything like that in the first place?

  • Pingback: Non-RAID Hot Swapping Help Needed()

  • @troll – thanks! Ya, it really isn’t hot swap it is really warm swap. The reason we are doing this is only for one of our appliances. It has 3 750GB (soon to be 1TB) drives that are the data drives. Our entire system has its own rebuilder which fixes any partition that breaks on its own, so we do not need RAID and plus we have the performance loss which we don’t want at all. We want to squeeze every bit of performance we can on these storage boxes, which aren’t like SANs or anything like that. Thanks for the quick comment!

  • Jim

    Did you try echo “scsi remove-single-device ” >/proc/scsi/scsi before unplugging the device? I use this all the time when a disk fails on scsi, sata and sas devices. It works quite well on 2.6 kernels. Also swapoff if you’re using swap on the device.

    There are a couple of issues with this, though. First, it can cause the box to crash. Doesn’t happen too often, mostly only on 2.4 kernel. Second, sometimes when you add a replacement disk with scsi add-single-device it gets a different device letter. e.g. remove sdb and add it back and it becomes sdc.

  • Jim

    hmm… it removed everything i put in brackets. so lets try that command syntax again. echo “scsi remove-single-device host bus target lun”. e.g. echo ‘scsi remove-single-device 0 0 1 0″ will remove sdb.

  • @Jim – ya, I read about the sdb becoming sdc and then fixing itself after rebooting as well. I know I have done this in the past with and without RAID, but I think that was all configured with the Compaq DL380s back then. Thanks!

  • Fabian Rodriguez

    Mhh… sorry for stating the obvious but… put them in external enclosures / docks ?

    Check this dock:

    This reviewer used it with Ubuntu 8.04 and it works out of the box.

    You may also use enclosures wich will better protect the drives, and have USB, firewire, network AND eSata connectors, so you can choose whatever works faster for you.

    Would that be what you want ? Next time ask the lazy web BEFORE spending your time on it ๐Ÿ˜‰

  • Fabian Rodriguez

    Oh, and ask mneptok where the best deal for docks is, I think he just got one ๐Ÿ™‚

  • Fabian Rodriguez

    Oh and external storage device assignments can be configured permanently by using the devices UUIDs in /etc/fstab (instead of device names). UUIDs can be fetched from this command:
    ls -l /dev/disk/by-uuid/

  • @Fabian – ya, lazy web from this point forward ๐Ÿ™‚ Anyways, the reason that works is because it converts the SATA drive to a USB drive, which everyone knows that USB is easily hot swappable. From the looks of it, warm swapping will be the route we will have to go. This system is a 2U setup that has 4 hot swappable drive bays. Oh this is so much fun ๐Ÿ™‚

  • zdz

    Modern way of signalling kernel that you are about to remove device is:
    echo 1 > /sys/bus/scsi/devices/0:0:0:0/delete

    change 0:0:0:0 to your device address.

  • Subscribe to

     Subscribe in a reader

    Or, subscribe via email:
    Enter your email address:

  • Archives

%d bloggers like this: