On Fri, Feb 1, 2019 at 3:28 AM Stefan K <shado...@gmx.net> wrote: > > Hello, > > I've installed my Debian Stretch to have / on btrfs with raid1 on 2 SSDs. > Today I want test if it works, it works fine until the server is running and > the SSD get broken and I can change this, but it looks like that it does not > work if the SSD fails until restart. I got the error, that one of the Disks > can't be read and I got a initramfs prompt, I expected that it still runs > like mdraid and said something is missing. > > My question is, is it possible to configure btrfs/fstab/grub that it still > boot? (that is what I expected from a RAID1)
It's not reliable for unattended use. There are two issues: 1. /usr/lib/udev/rules.d/64-btrfs.rules means mount won't even be attempted if all Btrfs devices are not found. 2. Degraded mounts don't happen automatically or by default; instead mount fails. It might seem like you can have a grub boot param 'rootflags=degraded' set all the time. While it's ignored if all devices are found at mount time, the problem is if one device is just delayed, you get an undesirable degraded mount. Three additional problems come from degraded mounts: 1. At least with raid1/10, a particular device can only be mounted rw,degraded one time and from then on it fails, and can only be ro mounted. There are patches for this but I don't think they've been merged still. 2. There is no automatic "catch up" repair once the old device returns. md and lvm raid will do a partial sync based on the write-intent bitmap, so it doesn't have to do a full sync. Btrfs should have all available information to see how far behind a mirror device (more correctly it's a stripe of a mirror chunk) and to do a catch up so the mirrors are all the same again; however there's no mechanism do do a partial scrub, nor to do a scrub of any kind automatically. It takes manual intervention to make them the same again. This affects raid 1/10/5/6. 3. At least raid1/10, if more than one device of a mirrored volume is mounted rw degraded - it's hosed. If you have a two device raid1, with device A and B; if A is mounted rw degraded and then later B is (separately) mounted rw degraded, they each have different states than the other, and those states are equally valid, and there's no way to merge them. Further, I'm pretty sure Btrfs still has no check for this, and will corrupt itself if you mount the volume rw (with all devices present, i.e. not degraded). I think there are patches for this (?) but in any case I don't think they've been merged either. So the bottom line is that the sysadmin has to handhold a Btrfs raid1. It really can't be used for unattended access. -- Chris Murphy