1. Home
  2. How To
  3. Dedicated Server
  4. Recovery Software RAID Array with adadm

Recovery Software RAID Array with adadm

Objectives

To properly rebuild a software RAID array after performing a hot swap.

Prerequisites

N/A

Steps

Step 1: Copy the Partition Table of Running Drive

Ensure the partition table of the new GPT disk (replacement disk) matches with the running disk. To do so, copy the partition table entries with the sgdisk command

sgdisk -R <New_Disk> <Existing_Disk>

For example:

sgdisk -R /dev/sdc /dev/sdb

For non-GPT disks, you can copy partition tables with the sfdisk command.

sfdisk -d <Existing_Disk> | sfdisk <New_Disk>

For example:

sfdisk -d /dev/sdb | sfdisk /dev/sdc

Step 2: Add Partition to Existing RAID Array

Now the partition table has been copied over to the new disk, the newly-created partition can be added to the running RAID Array via mdadm –add command.

For our case, we will be adding one of the new partitions of /dev/sdc to the running RAID Array /dev/md0

mdadm --add /dev/md0 /dev/sdc1

Step 3: Verify Status of RAID Array

Once the new partition had been added into the array, the rebuild process will be initiated automatically.

To verify the status of the RAID array, simply refer to the /proc/mdstat file.

cat /proc/mdstat
Updated on June 21, 2022

Was this article helpful?

Related Articles

Need Help?
Submit a ticket to us and let our professional team assists you

Support Billing Sales
Support
Billing
Sales