Post

Replacing disk in RAID1 on Debian/Ubuntu

So, my 13 years old Hitachi 2Tb HDD finally kicked the bucket.

Before

First, I made sure I have working backups. RAID1 is great, but it is NOT a backup!

Next is checking that GRUB is installed on both disks.
(All commands here are executed as root user).

1
dpkg-reconfigure grub-pc

Replace

Remove disk from /dev/md0.

1
2
3
sync
mdadm --manage /dev/md0 --fail /dev/sdb1
mdadm --manage /dev/md0 --remove /dev/sdb1

Replace the disk and then copy partition table from an existing sda to a new one sdb.

1
sfdisk -d /dev/sda | sfdisk /dev/sdb

Add the new disk.

1
mdadm --manage /dev/md0 --add /dev/sdb1

The rebuilding process will take some time (More than 5 hours in my case=)).

Check

1
mdadm -D /dev/md0

or

1
cat /proc/mdstat

Hero

Worked 13 years almost non-stop.

disk

This post is licensed under CC BY 4.0 by the author.