From: Siju George on
Hope some one finds this helpful :-)

--Siju

Rebuilding RAID 1 Array in Linux with a new hard disk after a disk fault.
=========================================================================

** Actual screen shot from terminal of steps taken during rebuild on
10-June-2010 on Debian Lenny ( Linux )**


1) Check the partitions layout on the current hard disk



srv1:~# fdisk /dev/sda

The number of cylinders for this disk is set to 60801.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0000dd6e

Device Boot Start End Blocks Id System
/dev/sda1 1 122 979933+ fd Linux raid autodetect
/dev/sda2 123 1338 9767520 fd Linux raid autodetect
/dev/sda3 1339 2554 9767520 fd Linux raid autodetect
/dev/sda4 2555 60801 467869027+ fd Linux raid autodetect

Command (m for help): quit

srv1:~#



2) Create identical partitions on the new disk using 'fdisk'.



Partition Id should be 'fd' for all RAID partitions. The resulting
layout should look like.

srv1:~# fdisk /dev/sdb

The number of cylinders for this disk is set to 60801.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xe3a3a447

Device Boot Start End Blocks Id System
/dev/sdb1 1 122 979933+ fd Linux raid autodetect
/dev/sdb2 123 1338 9767520 fd Linux raid autodetect
/dev/sdb3 1339 2554 9767520 fd Linux raid autodetect
/dev/sdb4 2555 60801 467869027+ fd Linux raid autodetect

Command (m for help): q

srv1:~#



3) Check the current RAID status

srv1:~# cat /proc/mdstat
Personalities : [raid1]
md3 : active raid1 sda4[1]
467868928 blocks [2/1] [_U]

md2 : active raid1 sda3[1]
9767424 blocks [2/1] [_U]

md1 : active raid1 sda2[1]
9767424 blocks [2/1] [_U]

md0 : active raid1 sda1[1]
979840 blocks [2/1] [_U]

unused devices:
srv1:~#

4) Rebuild the arrays and check thr status

srv1:~# mdadm -a /dev/md0 /dev/sdb1
mdadm: added /dev/sdb1
srv1:~# mdadm -a /dev/md1 /dev/sdb2
mdadm: added /dev/sdb2
srv1:~# mdadm -a /dev/md2 /dev/sdb3
mdadm: added /dev/sdb3

srv1:~# mdadm -a /dev/md3 /dev/sdb4
mdadm: added /dev/sdb4

srv1:~# cat /proc/mdstat
Personalities : [raid1]
md3 : active raid1 sdb4[2] sda4[1]
467868928 blocks [2/1] [_U]
[>....................] recovery = 0.0% (285440/467868928)
finish=54.5min speed=142720K/sec

md2 : active raid1 sdb3[0] sda3[1]
9767424 blocks [2/2] [UU]

md1 : active raid1 sdb2[0] sda2[1]
9767424 blocks [2/2] [UU]

md0 : active raid1 sdb1[0] sda1[1]
979840 blocks [2/2] [UU]

unused devices:
srv1:~#

5) Install grub on the MBR of new hard disk

srv1:~# grub-install /dev/sdb
Searching for GRUB installation directory ... found: /boot/grub
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.

(hd0) /dev/sda
(hd1) /dev/sdb
srv1:~#


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/AANLkTinFEzNI1ezQ0VkDo4rYhH7UOlrugaAJe9_L11fc(a)mail.gmail.com