TL;DR
Our monitoring raised a scary alert: "S.M.A.R.T. test failure detected" on one of the two NVMe drives in a dedicated server. The drive wasn't actually broken. It had simply used up its rated life. We replaced it, rebuilt the RAID1 mirror from the Hetzner Rescue System, and the server came back with zero data loss.
This post walks through what we saw, what the alert really meant, and the exact steps we followed. You don't need to be a Linux expert to follow along.
First, a quick explanation of RAID1
Our server has two NVMe drives that work as mirrors. This is RAID1: every piece of data is written to both drives at the same time.
Think of two notebooks. Every note you write goes into both. If one notebook is lost, the other still has everything.
Each drive is split into three sections (partitions), and each section on one drive is paired with the matching section on the other. Each pair is a mirror called an md device:
Mirror | Size | What it holds |
md0 | 32 GB | Swap (extra memory space) |
md1 | 1 GB | /boot (files needed to start the server) |
md2 | 444 GB | / (the operating system and all the data) |
Because of RAID1, losing one drive doesn’t mean losing data. That’s what made the swap safe.
The alert
It started with an email like this:
Drive Health Warning
Monitor: server.example.com
Status: S.M.A.R.T. test failure detected.
Drives affected: 1
Details:
Drive: nvme1n1
S.M.A.R.T. Test: FAILED!
Drive Wearout: 100.00%
Total Errors: 0
"FAILED" with "Total Errors: 0" looks odd. A drive that has failed usually has errors. That mismatch was our first clue.
Step 1: Ask the drive how it feels
Every modern drive keeps a health report called SMART. We read it with smartctl:
smartctl -a /dev/nvme1n1
The important lines (trimmed):
Model Number: SAMSUNG QWERTYUIOPLK-00B00
SMART overall-health self-assessment test result: FAILED!
- NVM subsystem reliability has been degraded
Critical Warning: 0x04
Temperature: 49 Celsius
Available Spare: 100%
Available Spare Threshold: 10%
Percentage Used: 100%
Power On Hours: 33,135
Media and Data Integrity Errors: 0
Error Information Log Entries: 98
How to read this:
Field | What it told us |
Critical Warning: 0x04 | The drive says its "reliability is degraded" |
Percentage Used: 100% | The drive has reached its rated write life (100% = fully used, not fully healthy) |
Available Spare: 100% | No flash cells have been retired. This is good |
Media Errors: 0 | No data corruption. This is good |
Power On Hours: 33,135 | About 3.8 years of running time |
The drive wasn't dying from damage. It was worn out by age and use, like a tyre with no tread left that still holds air.
Step 2: What did the hosting provider say?
We opened a ticket with Hetzner. Their answer, in short: the 0x04 flag appears once "Percentage Used" passes 100%, it only means the manufacturer's rated life is over, and as long as Available Spare stays above its threshold the drive can stay in service. They can't switch the warning off, but they offered to replace the SSD as a goodwill gesture.
We took the replacement. The drive was out of its rated life, and we preferred a planned swap to a surprise failure.
A plot twist: this had happened before
Three months earlier we'd had the same alert and the drive had already been replaced. So why again?
Comparing the SMART data from both incidents gave us the answer:
| August drive (replaced) | Drive that raised the alert now |
Serial | ending ...61772 | ending ...61750 |
Power-on hours | 34,875 | 33,135 |
Percentage Used | 100% | 100% |
The drive installed in August had fewer hours than the old one, even though it had been running for months. Working backwards, it arrived with roughly 31,500 hours already on it (an estimate based on the hours counter). In other words, the "replacement" was a used drive that was already nearly worn out.
Lesson: always check the SMART data of a replacement drive, especially Power On Hours and Percentage Used. Don't assume "replaced" means "new".
The swap and the “no operating system” surprise
Hetzner replaced the drive and then told us the server couldn’t find an operating system, so they had booted the Rescue System (a small temporary Linux that runs from the network).
No OS found didn’t mean our data was gone. The bootloader (GRUB, the program that starts the server) is not part of the RAID mirror. Each drive needs its own copy. The new drive was blank, so it had none.
From the Rescue System we checked the situation:
lsblk -o NAME,SIZE,MODEL,SERIAL,FSTYPE
NAME SIZE MODEL SERIAL FSTYPE
nvme0n1 476.9G SAMSUNG QWERTYUIOPLK-00B00 SASDF45GHJKL2
├─nvme0n1p1 32G linux_raid_member
│ └─md0 32G swap
├─nvme0n1p2 1G linux_raid_member
│ └─md1 1022M ext3
└─nvme0n1p3 443.9G linux_raid_member
└─md2 443.8G ext4
nvme1n1 476.9G SAMSUNG QWERTYUIOPLK-00B00 SASDF45GHJKL2
The good drive (nvme0n1) still had all its partitions and RAID members. The new drive (nvme1n1) was empty. We then checked the arrays:
cat /proc/mdstat
md2 : active raid1 nvme0n1p3[2]
465370432 blocks super 1.2 [2/1] [U_]
md1 : active raid1 nvme0n1p2[2]
1046528 blocks super 1.2 [2/1] [U_]
md0 : active raid1 nvme0n1p1[2]
33520640 blocks super 1.2 [2/1] [U_]
[U_] means "one drive up, one missing". The data was safe and running on one drive. We also checked the new drive's health before trusting it:
Critical Warning: 0x00
Percentage Used: 13%
Power On Hours: 7,901
This time the replacement was healthy.
The fix, in four steps (all from the Rescue System)
1. Copy the partition layout from the good drive to the new one
Careful: the first drive in this command is the source (good drive) and the second is the target (new drive). Reversing them wipes the good drive. Check the serial numbers with lsblk first.
sfdisk -d /dev/nvme0n1 | sfdisk /dev/nvme1n1
/dev/nvme1n1p1: Created a new partition 1 of type 'Linux raid autodetect' and of size 32 GiB.
/dev/nvme1n1p2: Created a new partition 2 of type 'Linux raid autodetect' and of size 1 GiB.
/dev/nvme1n1p3: Created a new partition 3 of type 'Linux raid autodetect' and of size 443.9 GiB.
The partition table has been altered.
The first drive is the source (good), the second is the target (new). This draws the same three empty boxes on the new drive.
2. Add the new partitions to the mirrors
mdadm /dev/md0 --add /dev/nvme1n1p1
mdadm /dev/md1 --add /dev/nvme1n1p2
mdadm /dev/md2 --add /dev/nvme1n1p3
mdadm: added /dev/nvme1n1p1
mdadm: added /dev/nvme1n1p2
mdadm: added /dev/nvme1n1p3
The system immediately starts copying data onto the new drive:
md0 : active raid1 nvme1n1p1[3] nvme0n1p1[2]
[>....................] recovery = 0.2% (97728/33520640) finish=5.6min speed=97728K/sec
The arrays rebuild one at a time, so don't worry if md1 says resync=DELAYED and md2 shows (S) for a while. They are just waiting their turn.
3. Put the bootloader on both drives
This is the step that fixes "no operating system". We mount our system and "step inside" it with chroot:
mount /dev/md2 /mnt
mount /dev/md1 /mnt/boot
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot /mnt /bin/bash
Then install GRUB on both drives:
grub2-install /dev/nvme1n1
grub2-install /dev/nvme0n1
Installing for i386-pc platform.
Installation finished. No error reported. Note: On Debian or Ubuntu, replace grub2-install with grub-install.
There were a couple of physical volume (null) warnings. They are harmless on our setup, which has no LVM: lsblk showed the RAID devices (md0, md1, md2) formatted directly as swap, ext3 and ext4, with no LVM layer in between.
This guide assumes no LVM. If your server uses LVM on top of the RAID devices, the rebuild steps are the same, because RAID sits underneath LVM. If your LVM sits directly on the partitions with no RAID, the steps are different and this guide doesn't apply.
Installing GRUB on both drives means the server can start even if one of them fails later
4. Wait for the rebuild, then reboot
Watch the progress with cat /proc/mdstat and wait until all three mirrors show [UU] with no recovery lines:
md2 : active raid1 nvme1n1p3[3] nvme0n1p3[2]
465370432 blocks super 1.2 [2/2] [UU]
md1 : active raid1 nvme1n1p2[3] nvme0n1p2[2]
1046528 blocks super 1.2 [2/2] [UU]
md0 : active raid1 nvme1n1p1[3] nvme0n1p1[2]
33520640 blocks super 1.2 [2/2] [UU] Then unmount and reboot:
umount /mnt/sys /mnt/proc /mnt/dev /mnt/boot /mnt
reboot Checking the result
After the reboot the server came up normally and all three arrays were [UU]:
[root@server~]# cat /proc/mdstat
md2 : active raid1 nvme1n1p3[3] nvme0n1p3[2]
465370432 blocks super 1.2 [2/2] [UU]
md0 : active raid1 nvme1n1p1[3] nvme0n1p1[2]
33520640 blocks super 1.2 [2/2] [UU]
md1 : active raid1 nvme1n1p2[3] nvme0n1p2[2]
1046528 blocks super 1.2 [2/2] [UU]
Downtime was limited to the swap and the reboot, and no data was lost.
One more thing we found
While checking the other drive, we noticed:
Critical Warning: 0x00
Percentage Used: 64%
Power On Hours: 5,019
64% used after only 5,019 hours is fast wear. It is healthy today, but it will probably need the same treatment in the future. It is better to plan that swap ahead than to be surprised by it.
Checking the new drive's health
After the reboot, we checked the new drive's SMART data one more time, to make sure the replacement is healthy and not another worn-out drive:
Command:
smartctl -a /dev/nvme1n1 | grep -E 'Model|Critical Warning|Available Spare|Percentage Used|Power On Hours|Data Units Written|Media and Data'
Output:
Model Number: SAMSUNG QWERTYUIOPLK-00B00
Critical Warning: 0x00
Available Spare: 100%
Percentage Used: 13%
Data Units Written: 27,510,615 [14.0 TB]
Power On Hours: 7,901
Media and Data Integrity Errors: 0What this tells us:
Critical Warning 0x00: no warning flags
Percentage Used 13%: most of the drive's rated life is still ahead of it
Available Spare 100%: no flash cells have been retired
Media Errors 0: no data corruption
Compare this with the drive we replaced (100% used, Critical Warning 0x04). The replacement is in much better shape.
Lessons learned
"FAILED" doesn't always mean broken. Read the details: spare blocks, media errors and percentage used tell the real story.
Check replacement drives. A "replacement" can be a used drive. Look at Power On Hours and Percentage Used before you trust it.
RAID is not a backup. It protects against a drive failing, but not against deleting a file or losing the whole server. Keep separate backups.
The bootloader is not mirrored. After any drive swap, install GRUB on both drives.
Triple-check before copying partition tables. Source and target in the wrong order can erase the good drive. Match the serial numbers first.
Don't leak rescue credentials. The rescue password is a root password while rescue is active. Keep it private, and use SSH keys where possible.
Tune your monitoring. A bare 0x04 flag should not wake someone up if the spare blocks are fine. Alert on the signals that matter.







