[CentOS] software raid1 syncing

Sat Jul 4 08:07:44 UTC 2009
Kay Diederichs <kay.diederichs at gmx.net>

Lucian at lastdot.org schrieb:
> On Fri, Jul 3, 2009 at 9:15 PM, Steven Vishoot<sir_funzone at yahoo.com> wrote:
>> hello all,
>> I have a setup that is raid 1 and put the mirrored drive back in and now it is still showing as degraded saying: raid1: raid set md6 active with 1 out of 2 mirrors with this message on all the raids.i know i am wrong by saying this but i thought putting in the driving and rebooting would start the re syncing itself. what do i have to do to add this back in, i am so confused with this process.
>> centos 4.x
>> _______________________________________________
>> CentOS mailing list
>> CentOS at centos.org
>> http://lists.centos.org/mailman/listinfo/centos
> Well, just putting a new disk drive in the place of the bad one
> doesn't cut it. You have to recreate partition table and then add the
> partitions to the drive.
> e.g.
> sda = the old disk in the raid that has not failed
> sdb = the newly added disk
> dd if=/dev/sda of=/dev/sdb bs=512 count=1
> That'll replicate the partition table and mbr to the new disk.
> Then starting addinf the new partitions to the linux raid:
> mdadm -a /dev/sdb1 /dev/md0 and so on, depending what your setup is.
> Do a:
> cat /proc/mdstat and see what partitions are added to which raid.
> Alternatively to a google search for howtos (e.g.
> http://www.gagme.com/greg/linux/raid-lvm.php ) and learn how to manage
> linux raid so you dont fsck up your system.

well as I just did that yesterday I'd wish to add:

a)  dd if=/dev/sda of=/dev/sdb bs=512 count=1
will also copy the grub info so it's a good thing to do if you ever want 
to be able to boot from the new disk if the old disk goes bad. However 
it does not seem to copy the info about the extended partitions, just 
the primary ones. So in my case (I needed a sdb5 and sdb6) I had to 
manually (using fdisk) prepare the extended partitions, taking the old 
disk as a template.

b) the syntax for mdadm is e.g.
mdadm /dev/md0 --add /dev/sdb1
AFAICT although mdadm seems to be pretty smart about getting it right.