mdadm how to repair degraded raid device


[16:55:57 root@xen1 ~ :/root]# mdadm --detail /dev/md2
/dev/md2:
Version : 0.90
Creation Time : Wed Apr 13 13:26:33 2011
Raid Level : raid1
Array Size : 9213120 (8.79 GiB 9.43 GB)
Used Dev Size : 9213120 (8.79 GiB 9.43 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 2
Persistence : Superblock is persistent

Update Time : Tue Mar 6 16:55:41 2012
State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 1
Spare Devices : 0

UUID : c19b28c1:ecbdf4f8:1a597600:a2292b4d
Events : 0.55948

Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 0 0 1 removed

2 8 17 - faulty spare /dev/sdb1

[16:56:01 root@xen1 ~ :/root]# mdadm --remove /dev/md2 /dev/sdb1
mdadm: hot removed /dev/sdb1
[16:56:37 root@xen1 ~ :/root]# mdadm --detail /dev/md2
/dev/md2:
Version : 0.90
Creation Time : Wed Apr 13 13:26:33 2011
Raid Level : raid1
Array Size : 9213120 (8.79 GiB 9.43 GB)
Used Dev Size : 9213120 (8.79 GiB 9.43 GB)
Raid Devices : 2
Total Devices : 1
Preferred Minor : 2
Persistence : Superblock is persistent

Update Time : Tue Mar 6 16:56:37 2012
State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 0
Spare Devices : 0

UUID : c19b28c1:ecbdf4f8:1a597600:a2292b4d
Events : 0.55948

Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 0 0 1 removed

[16:56:40 root@xen1 ~ :/root]# mdadm --add /dev/md2 /dev/sdb1
mdadm: re-added /dev/sdb1
[16:57:08 root@xen1 ~ :/root]# mdadm --detail /dev/md2
/dev/md2:
Version : 0.90
Creation Time : Wed Apr 13 13:26:33 2011
Raid Level : raid1
Array Size : 9213120 (8.79 GiB 9.43 GB)
Used Dev Size : 9213120 (8.79 GiB 9.43 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 2
Persistence : Superblock is persistent

Update Time : Tue Mar 6 16:57:06 2012
State : clean, degraded, recovering
Active Devices : 1
Working Devices : 2
Failed Devices : 0
Spare Devices : 1

Rebuild Status : 2% complete

UUID : c19b28c1:ecbdf4f8:1a597600:a2292b4d
Events : 0.55948

Number Major Minor RaidDevice State
0 8 1 0 active sync /dev/sda1
1 8 17 1 spare rebuilding /dev/sdb1

Posted in IT