How to prepare the Raid 5 for a disk swap. First you mark the drive as failed from the intact raid system. Then you can remove it and plug in the new disk.
Initial situation: Raid 5 is intact
root@homeserver:~# cat /proc/mdstat Personalities : [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid1] [raid10] md0 : active raid5 sdb1[0] sdd1[3] sdc1[1] 5860259840 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU] bitmap: 5/22 pages [20KB], 65536KB chunk unused devices: <none>
Mark the drive as failed
mdadm --manage /dev/md0 --fail /dev/sdb1 Personalities : [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid1] [raid10] md0 : active raid5 sdb1[0](F) sdd1[3] sdc1[1] 5860259840 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/2] [_UU] bitmap: 6/22 pages [24KB], 65536KB chunk unused devices: <none>
Remove the drive from the raid
mdadm --manage /dev/md0 --remove /dev/sdb1 root@homeserver:~# cat /proc/mdstat Personalities : [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid1] [raid10] md0 : active raid5 sdd1[3] sdc1[1] 5860259840 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/2] [_UU] bitmap: 6/22 pages [24KB], 65536KB chunk unused devices: <none>
root@homeserver:~# mdadm --detail /dev/md0 /dev/md0: Version : 1.2 Creation Time : Thu Sep 10 20:49:23 2015 Raid Level : raid5 Array Size : 5860259840 (5588.78 GiB 6000.91 GB) Used Dev Size : 2930129920 (2794.39 GiB 3000.45 GB) Raid Devices : 3 Total Devices : 2 Persistence : Superblock is persistent Intent Bitmap : Internal Update Time : Mon Nov 7 20:02:05 2016 State : clean, degraded Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 Layout : left-symmetric Chunk Size : 512K Name : homeserver:0 (local to host homeserver) UUID : 701632c7:fea9ac94:27ee3748:c5e57242 Events : 35283 Number Major Minor RaidDevice State 0 0 0 0 removed 1 8 33 1 active sync /dev/sdc1 3 8 49 2 active sync /dev/sdd1
To: root@homeserver.mattionline.lan Subject: Fail event on /dev/md0:homeserver This is an automatically generated mail message from mdadm running on homeserver A Fail event had been detected on md device /dev/md0. It could be related to component device /dev/sdb1. Faithfully yours, etc. P.S. The /proc/mdstat file currently contains the following: Personalities : [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid1] [raid10] md0 : active raid5 sdb1[0](F) sdd1[3] sdc1[1] 5860259840 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/2] [_UU] bitmap: 4/22 pages [16KB], 65536KB chunk