Apr 19 2012

software RAID repair (naprawa macierzy RAID)

1. In this example RAID  contents two disks (/dev/sda, /dev/sdb)  and 4 partitions ( md0, md1, md2, md3)
cat /proc/mdstat

Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]
md1 : active raid1 sdb5[1] sda5[0]
 20979264 blocks [2/2] [UU]
md2 : active raid1 sda6[0] sdb6[1]
 20979968 blocks [2/2] [UU]
md3 : active raid1 sdb7[1] sda7[0]
 880264320 blocks [2/2] [UU]
md0 : active raid1 sdb1[1] sda1[0]
 20979648 blocks [2/2] [UU]
unused devices: <none>

2. If the RAID fail you will see

cat /proc/mdstat
 Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]
 md1 : active raid1 sda5[0]
       20979264 blocks [2/1] [U_]
 md2 : active raid1 sda6[0]
       20979968 blocks [2/1] [U_]
 md3 : active raid1 sda7[0]
       880264320 blocks [2/1] [U_]
 md0 : active raid1 sda1[0]
       20979648 blocks [2/1] [U_]
 unused devices:

3. Disconnect failed hdd

4. Connect new hdd

5. Loook into dmesg for hdd letter

6. remove failed hdd from raid (usuniecie uszkodzonego dysku z macierzy)

mdadm /dev/md0 --fail detached --remove detached
mdadm /dev/md1 --fail detached --remove detached
mdadm /dev/md2 --fail detached --remove detached
mdadm /dev/md3 --fail detached --remove detached

7. copy partitions structure from old GOOD HDD to the new one ( kopiujemy strukture partycji z jednego dysku na drugi)

sfdisk -d /dev/sda | sfdisk /dev/sde

8. Add new hdd into RAID (# dodajemy nowo wsadzony dysk)

mdadm --add /dev/md0 /dev/sde1
mdadm --add /dev/md1 /dev/sde5
mdadm --add /dev/md2 /dev/sde6
mdadm --add /dev/md3 /dev/sde7

9. Rebuilding starts automaticaly, You can see RAID status by

cat /proc/mdstat

 10. and WHEN ALL PARTITIONS ARE REBUILDED run:

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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.