GRUB2: /boot as BTRFS subvolume

3

3

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.

user19087

Posted 2015-06-23T04:41:10.740

Reputation: 513

Answers

4

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.

user19087

Posted 2015-06-23T04:41:10.740

Reputation: 513

Can you please provide detailed instructions on how you did this? It will be useful for many. – Ravi – 2015-08-14T18:14:34.740

0

It's a bad idea since you wont be able to use efistub and boot the kernel directly without using grub.

If you want integrity, you can use md raid1 for /boot

orange_juice6000

Posted 2015-06-23T04:41:10.740

Reputation: 115