Rebuilding a Software RAID 1 Array

If a hard drive fails in a RAID 1 (Mirror), your data is still there, but your safety net is gone. Rebuilding means "teaching" a new, empty drive to become an exact copy of your remaining healthy drive.

Warning: This process requires absolute focus. You must correctly distinguish between your healthy drive (source) and the new empty drive (target). Mixing them up will result in total data loss.

How it works

Think of your RAID as two identical books. If one is destroyed, you buy a new one with empty pages. To restore your RAID, you must first draw the same lines (Partitioning) on the empty pages and then copy the text (Syncing) from the original book. Finally, you ensure the new book can be "read" at startup (Bootloader).

1

Step 1: Preparing the empty drive

A RAID only works if the partitions on both disks are identical. We copy the "blueprint" from your healthy disk (e.g., sdb) to the new disk (e.g., sda).

Identify your drives

Check which drive has partitions and which is empty:

List disks
fdisk -l

Replicate the layout (GPT/Modern)

This command copies the structure from sdb to sda and gives the new disk a unique ID:

Copy layout
sgdisk -R=/dev/sda /dev/sdb sgdisk -G /dev/sda
2

Step 2: Copying the data

Now that the new disk has the right "slots" (partitions), we tell the system to start copying the actual data into them.

Join the partitions to the RAID

Add the new partitions (sda1, sda3, etc.) to your existing RAID arrays (md0, md1):

Add to RAID
mdadm /dev/md0 --add /dev/sda1 mdadm /dev/md1 --add /dev/sda3

Watch the progress

The system is now busy copying. Do not turn off the server until this is finished:

Check status
watch cat /proc/mdstat
3

Step 3: Making the drive bootable

A mirror copies your files, but not the hidden "start-up code" (Bootloader). Without this step, your server will not start if the other disk fails.

Install Bootloader
mount /dev/md1 /mnt mount /dev/md0 /mnt/boot mount --bind /dev /mnt/dev mount --bind /proc /mnt/proc mount --bind /sys /mnt/sys chroot /mnt grub-install /dev/sda update-grub exit

Hardware defect confirmed?

In the event of a technical defect, we will replace your hard drive free of charge. To do so, please open a hardware ticket in your PowerPanel.