Replace failed Non Boot Disk in Linux : How to ?



Replacing Failed RAID Disk on Linux (Non boot disk)


This procedure can be used the disk is mirrored in RAID.


1. If the disk is hot-swappable, simply remove it. If it isn't, you'll need to schedule downtime and remove the disk.


2. Replace the failed disk and restart your machine,

3. After replacing the disk check the RAID status

# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sda1[0]
104320 blocks [2/1] [U_]

md1 : active raid1 sdb2[1] sda2[0]
522048 blocks [2/2] [UU]

md2 : active raid1 sda3[0]
4610560 blocks [2/1] [U_]

unused devices:

4. Repartition the disk, again, with sfdisk and we should end up with our partition table looking exactly the same
# sfdisk -d /dev/sda > mirror
# sfdisk /dev/sdb < mirror
The partition table should look almost identical

5. Now, just need to add back all the partitions
# mdadm -a /dev/md0 /dev/sdb1
# mdadm -a /dev/md1 /dev/sdb2
# mdadm -a /dev/md2 /dev/sdb3

6. Check the RAID details using the below command

# mdadm -D /dev/md0
# mdadm -D /dev/md1
# mdadm -D /dev/md2

Once the RAID sync is done then restart and check the status. 



Post a Comment

0 Comments