I'm not going to explain what a software RAID is. There is google for this.
However, i will try to summarize here how to remove a failed disk and add a new one instead of it. Follow the steps and ask if somethig failes...
1. Set the drive (in my example /dev/sda) as faulty
Code:
# mdadm --manage --set-faulty /dev/md0 /dev/sda
2. Remove the faulty disk from the array
Code:
# mdadm /dev/md0 -r /dev/sda
3. Stop the array
Code:
# mdadm -S /dev/md0
4. Re-assemble the RAID device
Code:
# mdadm --assemble --force /dev/md0 /dev/sda /dev/sdb /dev/sdc
You should have something like this now (sizes and name may be different)
Code:
storage:~# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90
Creation Time : Mon May 17 16:49:05 2010
Raid Level : raid5
Array Size : 1953524992 (1863.03 GiB 2000.41 GB)
Used Dev Size : 976762496 (931.51 GiB 1000.20 GB)
Raid Devices : 3
Total Devices : 2
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Mon May 17 16:50:04 2010
State : clean, degraded
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 32K
UUID : 4fbf11f1:d86da25c:0d590f16:adff46fb
Events : 0.2
Number Major Minor RaidDevice State
0 8 0 0 active sync /dev/sda
1 8 16 1 active sync /dev/sdb
2 0 0 2 removed
storage:~# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid5 sdb[1] sda[0]
1953524992 blocks level 5, 32k chunk, algorithm 2 [3/2] [UU_]
5. Add the new good disk to the raid array
Code:
# mdadm /dev/md0 -a /dev/sdc
mdadm: re-added /dev/sdc
You should have it like this now:
Code:
storage:~# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90
Creation Time : Mon May 17 16:49:05 2010
Raid Level : raid5
Array Size : 1953524992 (1863.03 GiB 2000.41 GB)
Used Dev Size : 976762496 (931.51 GiB 1000.20 GB)
Raid Devices : 3
Total Devices : 3
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Mon May 17 16:52:10 2010
State : clean, degraded, recovering
Active Devices : 2
Working Devices : 3
Failed Devices : 0
Spare Devices : 1
Layout : left-symmetric
Chunk Size : 32K
Rebuild Status : 0% complete
UUID : 4fbf11f1:d86da25c:0d590f16:adff46fb
Events : 0.6
Number Major Minor RaidDevice State
0 8 0 0 active sync /dev/sda
1 8 16 1 active sync /dev/sdb
[color=#FF0000]3 8 32 2 spare rebuilding /dev/sdc[/color]