Categories
FreeBSD How To OS

Rebuild IDE Mirror On FreeBSD

I’ve got a test system at work with a Promise ATA RAID controller in it. When I first put the card and drives in it I used the BIOS on the card to establish a mirror. This mirror took awhile to do (two 250gig IDE drives), but once it was done it worked fine. FreeBSD made use of it without any complaints.

Today I thought it would be nice to see how hard it is to rebuild the mirror, so powered off the system and pulled one of the drives. The BIOS on the card alerted me during boot up that the mirror had an error, but I wanted to be able to still use the system while the mirror was rebuilding (since it takes so long). That led me to atacontrol. Unfortunately the man page wasn’t enough for me to figure how to get the mirror to rebuild.

Some more time on Google and I came across post on the FreeBSD -current email list, Re: atacontrol rebuild, how?. This post gave me the extra bits of info that I needed to getting the rebuild going:

Perhaps something worth trying is the following – It’s what I have to do
to get the promisc card I use to rebuild:

– Identify the channel the drive is on (ie ad6 on ata3)

atacontrol detach ata3
atacontrol attach ata3
atacontrol addspare ar0 ad6
atacontrol rebuild

The command exits straight away but if you run: atacontrol status ar0
I get a ‘REBUILDING 0%’ message

Also checking the ps output shows a rebuild thread.

I’d tried the detach and attach steps before, but hadn’t tried addspare. That was the missing step, after that the rebuild started. It is still going to take a long time, but at least the system is usable while it is rebuilding. I haven’t tried it yet, but this should work fine for boot partitions also. Just remember to properly identify which drive failed 🙂