auto-rebuild RAID mirrors

Bill McGonigle bill at bfccomputing.com
Tue Apr 17 23:14:30 EDT 2007


My Google-fu may be weak, but I'm not finding much on automatically  
rebuilding RAID arrays under linux.

Here's the scenario:  I have a RAID-10 stack of disks I use for  
backup.  All are USB, two are fixed, two are in slide-out trays.  I  
have two sets of the ones in the slide out trays.  To do a backup, I  
fail out the removable disks, turn off the cases, pull the drives,  
drive them over to the bank, and swap the set.  I bring the other two  
back, swap them in, turn on the cases, and then do:

   cat /proc/mdstat

to figure out the RAID devices again,

   dmesg|tail

to see which drive letters the disks got assigned, then, e.g.:

   mdadm --manage --add /dev/md7 /dev/sdh1

for each drive and then they're synced with the current mirror and  
life goes on happily.

But I'm Lazy.  The drives were previously part of the arrays, so I  
can query the UUID info on each array and each drive with an 'fd'  
type by parsing /proc entries and using:

   mdadm --examine

I'm pretty confident that I can write a hotplug script (or something)  
to watch for new devices and do The Right Thing, at least with RAID-1  
devices (I haven't thought enough about other RAID types).

So, gentle reader, if it's so darn easy, why:
* already in the kernel or hotplug scripts
* isn't it automatic

I'm just having trouble with the premise that nobody's tried this  
yet, as it doesn't seem all that awful hard and it does seem awful  
useful.  So, usually that means I'm missing something (often obvious)  
and that it's a Bad Idea.  But I haven't figure out yet what that  
might be.  Criticisms required.

Sorry for the on-topic post. ;)

-Bill

-----
Bill McGonigle, Owner           Work: 603.448.4440
BFC Computing, LLC              Home: 603.448.1668
bill at bfccomputing.com           Cell: 603.252.2606
http://www.bfccomputing.com/    Page: 603.442.1833
New Blog: http://blog.bfccomputing.com/
VCard: http://bfccomputing.com/vcard/bill.vcf



More information about the gnhlug-discuss mailing list