Image

Image

Search This Blog

Saturday, June 19, 2010

Replacing a failing software raid drive in 10 easy steps

Un post de acum 3-4 ani pe care unul din amicii de la birou n-a fost in stare sa-l gasesca pe board-ul intern:

1 - cat /proc/mdstat and check for referrences to failing device
(sda = first sata hdd, sdb = the second one, so on...) the failed
partition should be something like /dev/sdb5 (I'm goin to refer to this
partition as /dev/sdYn and I'm going to call the good one /dev/sdXn)
2 - fdkisk -l /dev/sdX (where sdX is the GOOD hdd); fdisk -l /dev/sdY
- take a note of all partition configuration
3 - remove failed hdd: mdadm --manage /dev/md0 --fail /dev/sdYn ;
mdadm --manage /dev/md0 --remove /dev/sdYn (/dev/sdYn is the failed device!)
4 - phisically replace hdd (maybe with a shutdown before? :-) )
5 - sfdisk -d /dev/sdX | sfdisk /dev/sdY will create identical partitions
on the new hdd, similar to the ones on the good hdd (usually a /boot
of 100MB as primary partition and the rest as extended type FD "Linux
raid autodetect")
6 - check if the partitions are identical: fdkisk -l /dev/sdY
(compare with what you read at step 2)
7 - mdadm --manage /dev/md0 --add /dev/sdYn will add the new
partition tothe raid array
8 - watch the rebuid procedure: watch -n 10 cat /proc/mdstat (if
you are bored type ^C - the rebuid is done anyway)
9 - in order to make a copy of the boot partition too, do a mount
/dev/sdY1 /boot2 (the first partition is usually the 100MB /boot), then
do acd /boot ; find . -depth -print | cpio -padmV /boot2 ; grub-install /dev/sdY
10 - enjoy a beer, you have a working raid again!

Blog Archive