4

UEFI requires booting from a ESP which is most of the time formatted as vFAT. If I recall correctly BTRFS could have sub-volumes formatted as ext3/ext4 like the Logical Volume Manager (LVM). However, UEFI doesn't support booting from BTRFS. Most of the time the solution is simply to use three (or 2N + 1) disks, two for the RAID and one from which to boot. My main concern in this case is simple RAID1 mirroring. In this case though I can only use two disks. If the motherboard were using BIOS then I could simply mirror the boot partition.

I've heard that this issue (having to use an extra disk to boot from) is one motivation why people have switched to (freeBSD with) ZFS, although I might be recalling falsely.

In my case what I did is mirror an entire disk with a partition. Id est, the second disk had two partitions: one ESP, one btrfs partition. However, I'm assuming this is not how BTRFS-RAID1 is intending to be used. So my question is concretely:

  • Will this configuration lead to corruption or other unintended consequences?
  • What would a better solution be?
1

From what I gather in your statements, you have two disks with the following (or similar) disk layout:

sda: GPT
  sda1: Linux MD RAID member
  sda2: Swap
  sda3: BTRFS pool member (RAID 1 allocation policy)

sdb: GPT
  sda1: Linux MD RAID member
  sda2: Swap
  sda3: BTRFS pool member (RAID 1 allocation policy)

md0: ESP (~100mb? VFAT) mounted at /boot/efi (RAID 1 allocation policy)

BTRFS pool: 
  root subvol (mounted at /)
  home subvol (mounted at /home)
  et cetera ad nauseam.

This is exactly what you want in almost all cases, and if your configuration doesn't reflect this you'll probably want to make it reflect this.

The Linux MD volume in this case is a RAID 1 between sda1 and sdb1. Don't mess with sd[a,b]1 directly, and only ever mount the MD volume created from them (usually /dev/md0 or /dev/md/0 unless you've felt the need to give it a special name during creation). You absolutely must use RAID1 for the ESP volume, since the motherboard firmware expects to find that data intact on any single disk at boot time.

The swap partitions will naturally stripe, but a failure of one will not crash your system in almost all cases. Don't use MD for swap unless you have a good reason, as the pager is very smart.

The BTRFS pool will scan automatically, so it's best to specify this volume by UUID when adding entries for it in the /etc/fstab file.

GRUB2 can boot from any BTRFS RAID level. Just make sure that the "stage 1" loader is installed to both of the partition tables (sda, sdb). This is done when invoking grub-install /dev/sda (may be slightly different depending on distribution).

  • 1
    You cannot use EXT* or any other filesystem on top of BTRFS. That's a ZFS feature. BTRFS subvolumes are more like directories, and are treated like them. Yes, BTRFS doesn't have a good way to manage block devices volumes directly. It's a filesystem with volume management, rather than ZFS, which is a volume manager with a filesystem. – Spooler Jan 23 '17 at 2:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.