auto-rebuild RAID mirrors
Derek Atkins
warlord at MIT.EDU
Wed Apr 18 11:12:51 EDT 2007
I used to use the attached script. Note that it USED to work,
but I haven't tested it on recent systems. I originally wrote
it on RHL9, and I think I updated it for FC1, but I dont think
I've tested it more recently than that, so YMMV.
This script assumes RAID1 and matching drives (not raid 10). It also
assumes IDE, not USB or SATA.
But hopefully it'll at least give you some clues if not a working
rebuild script..
It's in PERL.
-derek
Bill McGonigle <bill at bfccomputing.com> writes:
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: raid-rebuild.pl
Type: application/octet-stream
Size: 8101 bytes
Desc: Raid Rebuild Script
Url : http://mail.gnhlug.org/mailman/private/gnhlug-discuss/attachments/20070418/adee7398/raid-rebuild-0001.obj
-------------- next part --------------
--
Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
Member, MIT Student Information Processing Board (SIPB)
URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH
warlord at MIT.EDU PGP key available
More information about the gnhlug-discuss
mailing list