Skip to main content
To check software RAID on Linux, run cat /proc/mdstat: [UU] means every disk is working, [U_] means the array is degraded and a disk has failed. sudo mdadm --detail /dev/md0 shows which one. To replace it, mark it failed and remove it (mdadm --manage /dev/md0 --fail /dev/sdb1 --remove /dev/sdb1), have the disk swapped, copy the partition table to the new disk, then --add it and watch the rebuild.

Before you start

  • This page is mainly for dedicated servers with two or more physical disks in Linux software RAID. On a VPS you see virtual disks, and /proc/mdstat normally lists no arrays. Protect VPS data with panel backups and your own off-server backups instead.
  • RAID is not a backup. It keeps the server running when a disk dies, but deletions, corruption and ransomware hit every disk at once. Back up before you touch a degraded array: a second disk can fail during a rebuild.
  • Commands use sudo; root users can leave it out. Install mdadm if needed: sudo apt install mdadm or sudo dnf install mdadm.
  • If your server uses a hardware RAID controller, mdadm does not manage it. Open a ticket if you are unsure which you have.

How to check RAID status

A healthy two-disk RAID 1:
For details on one array:
Look at State : (clean is good; degraded means a disk is missing), Failed Devices :, and the table at the bottom, which shows each member as active sync, faulty or removed.

How to replace a failed disk in mdadm RAID 1

Mistakes here can destroy the only good copy of your data. Take a backup first, check every device name twice, and never run commands against the healthy disk. Only ever fail and remove the member that is already faulty, never one that shows active sync. When in doubt, stop and open a ticket.
The examples assume sda is healthy and sdb has failed, with partitions sdb2 in md1 and sdb3 in md2. Use your own names from /proc/mdstat.
1

Identify the failed disk by serial number

Write down the serial number of the failed disk and of the healthy disk. The data centre uses the serial to pull the right drive.
2

Mark its partitions as failed and remove them

Do this for every array the disk belongs to:
If a partition is already gone, mdadm says so; continue with the next one.
3

Ask for the disk to be replaced

Open a ticket with the failed disk’s serial number and the healthy disk’s serial number, and ask when the swap will happen.
4

Find the new disk

After the swap, run lsblk. The new disk has no partitions. It may get a different name, so confirm by serial number.
5

Copy the partition table from the healthy disk

-R /dev/sdb /dev/sda copies from sda to sdb. -G gives the copy new unique IDs. sgdisk is in the gdisk package.
Check which type you have with sudo parted /dev/sda print (Partition Table: gpt or msdos).
Getting the order wrong overwrites the healthy disk’s partition table. The target (new disk) comes right after -R; the source (healthy disk) comes last.
6

Add the new partitions to the arrays

7

Watch the rebuild

Wait until every array shows [UU] again. Press Ctrl+C to leave watch. The server stays usable, but disk-heavy work is slower until the rebuild finishes.
8

Install the boot loader on the new disk

So the server can still boot if the other disk fails later. On BIOS (legacy) boot:
On UEFI servers the EFI system partition is set up differently per installation. Open a ticket if you are not sure how yours boots.

How to get email alerts when a RAID disk fails

mdadm’s monitor sends an email when an array degrades. It needs a working mail setup on the server (a mail transfer agent such as Postfix).
  1. Set the address in the config file, /etc/mdadm/mdadm.conf on Ubuntu / Debian or /etc/mdadm.conf on AlmaLinux / Rocky:
  2. Restart the monitor: sudo systemctl restart mdmonitor.
  3. Send a test alert for each array:
You can also check /proc/mdstat from your own monitoring. See get email alerts when your server goes down.

How to run a RAID consistency check

A check reads every block and compares the disks:
On Ubuntu 24.04, the mdadm package already includes mdcheck_start.timer, which starts a check on the first Sunday of each month. Seeing check = …% in /proc/mdstat at that time is normal.

Frequently asked questions

Can I keep using the server while the array is degraded?

Yes, but you have no redundancy: if the remaining disk fails, the data is gone. Back up and replace the disk as soon as you can.

How long does a RAID rebuild take?

It depends on disk size and speed. /proc/mdstat shows an estimate as finish=. Large hard disks can take many hours.

How do I check if a disk is about to fail?

Use SMART data: see check disk health with smartctl. Reallocated or pending sectors are early warnings.

Does software RAID exist on my VPS?

Normally you only see virtual disks inside a VPS, and cat /proc/mdstat shows no arrays. Protect VPS data with backups.

VPS and dedicated server guides

Every guide in this section.

Check disk health with smartctl

Spot failing disks early.

Back up a Linux server

RAID is not a backup.

Use LVM on Linux

Flexible volumes on top of RAID.

VPS vs dedicated server

What changes with physical disks.

Checked against the official Red Hat Enterprise Linux guide to replacing a failed disk in RAID and the Linux kernel md documentation on 4 November 2026; the sgdisk -R/-G and sfdisk partition-table copy was tested on Ubuntu 24.04 LTS using loop devices, and the mdadm options were checked against mdadm 4.3’s built-in help. Array commands could not be run in our test environment. Commands can differ on other distributions or releases.

Need Extra Help?

If you encounter any issues, our support team is ready to assist:

Save on Your Hosting

Ready to upgrade your hosting? Use code KB20 at checkout for 20% off your first order!

Last Updated: November 2026