Linux – GRUB2: /boot as BTRFS subvolume

bootbtrfsgrublinux

Aside from /boot, all my partitions (including root, /) are BTRFS subvolumes. I'm switching to BTRFS RAID1, and for the sake of integrity, want to include /boot within the BTRFS partition. Preferably as a separate subvolume (quota support) but possible as part of the root subvolume. I'm using the latest fedora, 22, which means:

  • grub2 2.02-0.16.fc22
  • btrfs-progs 4.0-1.fc22
  • kernel 4.0.4-303.fc22

Is this possible (yes/no)? Please provide information on any BTRFS+GRUB specific setup. I mean, creating a new subvolume and copying data is relatively straightforward, but getting the whole contraption to actually boot is another problem entirely.

Best Answer

Yes. Myself successfully moved /boot into the BTRFS system as a subvolume. No special consideration necessary - just don't forget to reinstall grub and rebuild the initramfs.

edit:

Will require running grub2-mkconfig -o /boot/grub2/grub.cfg after every upgrade involving a kernel (linux, memtest, etc) or during/after a fedora upgrade (fedup) as grubby does not support updating grub.cfg on btrfs subvolumes. There is a patch available [#864198 - see attachments] which hasn't been integrated because it's a hack. With kernel-install and BootLoaderSpec, grubby seems to be nearing end-of-life, so I don't find it objectionable.

TLDR:

Requires updating grub.cfg manually every post-kernel upgrade, which is painless unless you've directly edited it.

Related Question