[lug] Raid question

Jason Schaefer js at jasonschaefer.com
Wed Mar 4 14:35:49 MST 2009

On Wed, Mar 4, 2009 at 10:31 AM, Carl Wagner
<carl.wagner at verbalworld.com> wrote:
> Hi,
> I have a Debian box using software RAID on 2 drives (mirroring). One of the
> drives was failing so I removed it (it was causing a lot of strange issues).
> I have done a few upgrades on this box and rebooted it after each of them to
> make sure they did not break anything.  This is with the bad drive missing.
> I pulled a spare drive out of another system that is about the same size.
> How do I get the mirroring working again and make sure I don't scramble the
> good drive?
> Will a simple boot work and somehow detect which drive is the raid drive.
> The other drive was pulled from a working system.
> Should I format the "new" drive just to make sure it does not become the
> master?
> After booting, will I need to do:
> mdadm /dev/md0 -a /dev/sda1
> ...
> To all the partitions?
> Thanks,
> Carl.


This is what I would do

boot into your system, install sfdisk if you don't have it... apt-get
install sfdisk

clone the partitions of the good sda to the new sdb
sfdisk -d /dev/sda1 | sfdisk /dev/sdb

then hot add the sdb partitions into the raid1
mdadm -a /dev/md0 /dev/sdb1
mdadm -a /dev/md1 /dev/sdb2

check on the rebuild:
mdadm --detail /dev/md0

the new disk is going to have a new uuid....

mdadm --detail --scan >> /etc/mdadm/mdadm.conf

use the new uuid that the above command appended to mdadm.conf in
place of the old and delete the rest.

I hope I didn't miss anything:-)

More information about the LUG mailing list