Contents
How to save a raid with Btrfs replace?
There are many examples how to save a RAID system when the faulty disk still remain somewhat accessible by the OS. btrfs replace command requires a source disk. No error message, but status indicate it never started. I cannot figure out what the problem with my attempt is. I am running Ubuntu 16.04 LTS Xenial Xerus, Linux kernel 4.4.0-57-generic.
What happens if a disk fails in Btrfs?
If a disk in a btrfs RAID 1 array fails, then btrfs will refuse to mount that filesystem and error messages will be visible in the syslog. If it was the root filesystem, then the system will refuse to boot normally and the system will usually boot to an initramfs console.
What to do when a disk in a RAID array fails?
The correct thing to do when a disk in an RAID array fails, is to replace it. Once you have a new disk in place notify btrfs about it with the command: This command reads files both from the original drive (if still accessible) and from other disks in the RAID array, and uses that information to populate the new clean disk.
When does Btrfs need to be mounted in degraded mode?
But, if a device is missing or the super block has been corrupted, the filesystem will need to be mounted in degraded mode: btrfs device delete missing tells btrfs to remove the first device that is described by the filesystem metadata but not present when the FS was mounted.
Why does one disk need to be replaced in Btrfs?
I have a BTRFS RAID-1 filesystem with 2 legs. One disk needs to be replaced because of re-occuring read errors. I assume that btrfs does the right thing, i.e. create a 3 way mirror. The alternative would be to use a balance filter, I guess. But since the filesystem already is a RAID-1 one, that shouldn’t be necessary?
Can you run Btrfs device delete / Dev sdb1?
In some cases one could also run btrfs device delete missing /dev/sdb1 and then add a new drive, but the replace command is the primary command and can be run even if the old drive is completely dead.
How to check the status of Btrfs replace?
The btrfs replace command is executed in the background – you can check its status via the status subcommand, e.g.: Alternatively, one can also add a device to raid-1 filesytem and then delete an existing leg: The add should return fast, since it justs adds the device (issue a btrfs fi show to confirm).