RAID 1 | Newbie Question
Hi.
I might be a first time user with btrfs for a new system I will set up.
Just want to make sure: As I read the docs, the note about RAID 1 and that there will be no redundant data is true only, if the RAID, which is possible, is set up to use only 1 physical device, right?
If RAID 1 using btrfs is defined to use two seperate disk, say /dev/sda2 and /dev/sdb2, I will have the same redundancy like using md. Is this correct?
Thanks,
Steffi
Quoted 6 lines · Stefanie Leisestreichler
Hi.
I might be a first time user with btrfs for a new system I will set up.Just want to make sure: As I read the docs, the note about RAID 1 and that there will be no redundant data is true only, if the RAID, which is possible, is set up to use only 1 physical device, right?
You can't set up btrfs RAID-1 to use only one device. It's only
possible to end up like that if you set up a 2-device RAID-1 and then unplug a device and mount it in degraded mode.
Quoted 2 lines
If RAID 1 using btrfs is defined to use two seperate disk, say
/dev/sda2and/dev/sdb2, I will have the same redundancy like using md. Is this correct?
You'll have two copies, so one device redundancy, regardless of the
number of devices. Traditional RAID-1 will use as many copies as devices; btrfs RAID-1 is two copies. (Although there are 3-copy and 4-copy variations in the latest kernels).
Hugo.
Signature · 4 lines
Hugo Mills | You can play with your friends' privates, but you hugo@... carfax.org.uk | can't play with your friends' childrens' privates. http://carfax.org.uk/ | PGP: E2AB1DE4 | C++ coding rule
Quoted 3 lines · Hugo Mills
You can't set up btrfs RAID-1 to use only one device. It's only
possible to end up like that if you set up a 2-device RAID-1 and then unplug a device and mount it in degraded mode.
It was this sentence in the btrfs wiki, what confused me, also comments in the net that btrfs is not giving you RAID with redundant data (https://btrfs.wiki.kernel.org/index.php/FAQ):
"It is possible with all of the descriptions below, to construct a RAID-1 array from two or more devices, and have those devices live on the same physical drive. This configuration does not offer any form of redundancy for your data."
Quoted 7 lines · Stefanie Leisestreichler
Quoted 3 lines · Hugo Mills
You can't set up btrfs RAID-1 to use only one device. It's only
possible to end up like that if you set up a 2-device RAID-1 and then unplug a device and mount it in degraded mode.
Quoted 8 lines
It was this sentence in the btrfs wiki, what confused me, also comments in the net that btrfs is not giving you RAID with redundant data
(https://btrfs.wiki.kernel.org/index.php/FAQ):"It is possible with all of the descriptions below, to construct a RAID-1 array from two or more devices, and have those devices live on the same physical drive. This configuration does not offer any form of redundancy for your data."
There's a difference between "device" and "disk" here. If you make
two partitions on one device, and that device fails, then there's no (disk) redundancy.
If you make two partitions on one disk and one partition on another
disk, and use all three partitions (block devices) to make a RAID-1, then you're still going to lose the filesystem if the disk with two partitions on it fails.
I'm not sure what the comments are about not giving redundant data
-- if you configure your FS to use one of the redundant RAID levels, then that's what you get.
Hugo.
Signature · 4 lines
Hugo Mills | emacs: Eighty Megabytes And Constantly Swapping. hugo@... carfax.org.uk | http://carfax.org.uk/ | PGP: E2AB1DE4 |
Quoted 4 lines · Hugo Mills
Quoted 4 lines
"It is possible with all of the descriptions below, to construct a RAID-1 array from two or more devices, and have those devices live on the same physical drive. This configuration does not offer any form of redundancy for your data."
Quoted 8 lines
There's a difference between "device" and "disk" here. If you make
two partitions on one device, and that device fails, then there's no (disk) redundancy.If you make two partitions on one disk and one partition on another
disk, and use all three partitions (block devices) to make a RAID-1, then you're still going to lose the filesystem if the disk with two partitions on it fails.
OK, this makes sense to me and cleared things up.
I still do not get the clue why it is explicitly mentioned in the wiki that there will be no redundany for the data if one uses just one disk in case of a disk failure. This is pretty obvious instead.
Thanks,
Steffi
I haven't looked at the wiki in a bit so I'm not sure if it points out two common gotchas:
Mismatch between SCT ERC and SCSI driver (used by libata and maybe also usb) timeouts. Btrfs needs explicit read errors on bad sectors to do automatic fix ups, same as md.
https://raid.wiki.kernel.org/index.php/Timeout_Mismatch
There's no automatic degraded state for Btrfs. And it is not a good idea to add the degraded mount option to fstab, as it can result in a kind of "split brain" corruption. In the case of member device failure, at startup time the mount will fail and you'll need to manually mount degraded and fix the problem resulting in the need to mount degraded. An alternative is maybe modifying the current btrfs udev rule, to timeout after a decently long period of time to ensure it's really a case of needing degraded mount, rather than merely a slow or transient effect that just needs a delay so that all member devices are available when mount is called. But I don't know if udev has a concept of waiting. For mdadm this is done in the initramfs.
--
Chris Murphy
23.04.2020 00:13, Chris Murphy пишет:
Quoted 8 lines
I haven't looked at the wiki in a bit so I'm not sure if it points out two common gotchas:
Mismatch between SCT ERC and SCSI driver (used by libata and maybe also usb) timeouts. Btrfs needs explicit read errors on bad sectors to do automatic fix ups, same as md.
https://raid.wiki.kernel.org/index.php/Timeout_Mismatch
Quoted 12 lines
There's no automatic degraded state for Btrfs. And it is not a good idea to add the degraded mount option to fstab, as it can result in a kind of "split brain" corruption. In the case of member device failure, at startup time the mount will fail and you'll need to manually mount degraded and fix the problem resulting in the need to mount degraded. An alternative is maybe modifying the current btrfs udev rule, to timeout after a decently long period of time to ensure it's really a case of needing degraded mount, rather than merely a slow or transient effect that just needs a delay so that all member devices are available when mount is called. But I don't know if udev has a concept of waiting. For mdadm this is done in the initramfs.
mdadm starts per-array systemd timer via udev rule when the first member device is detected. When this timer triggers (it is expected to trigger before normal systemd device wait timeout) timer starts service that effectively calls "mdadm --run".
If btrfs exposed filesystem in sysfs immediately when the first member device was detected and also checked "mountability" every time member device is added, similar mechanism could be implemented. Or dedicated service that makes decision ... the primary problem is that currently there is no way to know how many devices are there or whether these devices are enough to mount filesystem even though kernel does know this information.