BTRFS - how to replace a failed drive

1

I have a RAID10 BTRFS on /dev/sda4, /dev/sdb4, /dev/sdc4, and /dev/sdd4.

The sdd drive failed. I replaced it, and rebuilt the partition table like with sfdisk -d /dev/sda | sfdisk /dev/sdd.

I managed to mount the btrfs filesystem in its degraded state with mount -o degraded, but now I cannot figure out how to replace the old /dev/sdd4 in the filesystem with the new /dev/sdd4.

When I try to delete the missing device:

root@sauron:~# btrfs device delete /dev/sdd4 /big1
ERROR: error removing the device '/dev/sdd4' - unable to go below four devices on raid10

This is the replace command I tried. It has no output, but then when I check the status, it shows it was never started:

btrfs replace start /dev/sdd4 /dev/sdd4 -r /big1

The other partitions on these disks are four-way MDRAID1 devices, which I have successfully fixed on the new drive with the mdadm command.

I've been scouring google for help, but nothing I have found has been helpful.

elyograg

Posted 2015-11-15T18:26:02.780

Reputation: 113

Answers

2

According to documentation:

In case of raidXX layout, you cannot go below the minimum number of the device required. So before removing a device (even the missing one) you may need to add a new one.

mount in degraded mode
add a new device
remove the missing device

See here

Linef4ult

Posted 2015-11-15T18:26:02.780

Reputation: 3 705

1This did fix it. Now I'm doing a filesystem balance. Looks like everything's going to be fine. – elyograg – 2015-11-16T04:22:25.827