Replacing a device in a RAID

When an array member fails, it's important to replace it as soon as possible because the failure of additional drives increases the chance of data loss. This recipe teaches you how to properly replace a bad drive and rebuild the array.

Getting ready

This recipe requires a CentOS system with administrative privileges provided by logging in with the root account or using sudo. It assumes that a RAID-1 configuration has been set up as described in the previous recipe and the drive that will be replaced is /dev/sdb.

How to do it...

Follow these steps to replace a failed disk in a RAID:

  1. Mark the failed partition as faulty with mdadm using the -f option:
    mdadm /dev/md/md0 -f /dev/sdb1
    
  2. Remove the partition from the RAID's configuration ...

Get CentOS 7 Server Deployment Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.