0

I currently switched my BTRFS-based gentoo system to using raid1 (basically a 2nd harddisk got unused, so I used it as raid1).

I could extend the btrfs filesystem with a second device in raid1 mode. But since then grub2 will not boot any longer. Is it possible to let grub2 boot into a btrfs root filesystem which uses raid1 (and is on a subvolume), without having an initramfs? Until yet I never used an initramfs, because on gentoo this seems to be a bit too complex.

When I try booting, I only get kernel panics - it seems the kernel cannot properly mount the rootfs. Until I switched to raid1 for the rootfs, though, the system did boot normally, so this seems to be caused by raid1.

Another related question - both partitions (sda5,sdb5) used for the rootfs have the same UUID. Is this normal?

2

Yes, it is possible to do so, but it can be unreliable.

You need to explicitly tell the kernel about each individual device of the volume using the rootflags parameter on the kernel command-line like so:

rootflags=device=/dev/sda5,device=/dev/sdb5

This has a couple of very specific limitations:

  • It may not work if you're using an old kernel. I've only done this on 4.10 and newer myself, but I know it did not work on some 3.x kernels.
  • You can only use device paths for the device= values, and they have to be paths that aren't created by udev. Without an initramfs, you don't have the luxury of using blkid to find devices, and you don't have links created by udev yet when you try to mount the root filesystem.
  • You will need to manually update thisany time you change your partition layout.

As to your secondary question, yes, it is normal for each device in a BTRFS volume to share the same UUID. UUID's as reported by blkid and similar tools are per-filesystem, not per-device, so a multi-device filesystem will show the same UUID for each component device.

0

I did experiment with the "device=..." approach, but it did not work at all - I reliably got a kernel panic on startup. This may be due to the fact that I am using 4.9.76 as kernel - maybe this only works for 4.10 or newer. Anyways - I gave up, looked at https://wiki.gentoo.org/wiki/Btrfs/Native_System_Root_Guide (I am using gentoo) and built an initramfs according to this guide. If you follow this guide, though, you may also need to add following lines to the file initramfs_list:

    #some devices
    nod /dev/console 644 0 0 c 5 1
    nod /dev/tty0    644 0 0 c 4 0

Otherwise you may get a "cannot open initial console" error.

This initramfs based approach works now.

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.