# Btrfs Raid1 as root partition w/o initrd and GRUB2?

## Randy Andy

Hi Geeks,

I'm trying to use a Btrfs Raid1 as my new root filesystem, but I can't get it mounting via kernel command line, probably cause I didn't found the right parameters.

Another challenge is, I'm not willing to use a initrd nor GRUB2, but as far as I'm read about it, it should be possible at all.

Under this conditions there is no way to boot directly from the btrfs Raid, that's why I'm using a separate boot partition with grub-legacy installed on sda1.

I assembled the btrfs raid1 on sda2 and sdb2 partition and created some different subvolumes on it, one called @Gentoo-1 should be my new root to boot from.

When I boot from a different Gentoo storage, I have no problem to mount it via:

```
 LABEL=RAID-1           /mnt/Raid       btrfs   defaults,relatime,subvol=@Gentoo-1,compress=lzo,autodefrag   0 1
```

But how can I boot from as my new root=    system?

Below are some combinations I tried as entry into my grub.conf when trying to boot from:

```
title=@Gentoo-1 Btrfs root

root (hd0,0)

kernel /boot/kernel-x86_64-3.12.0-gentoo-LZO root=/dev/sda2  rootfstype=btrfs  rootflags=subvol=@Gentoo-1,compress=lzo

or with a different last line like this:

kernel /boot/kernel-x86_64-3.12.0-gentoo-LZO root=/dev/sdb2  rootfstype=btrfs  rootflags=subvol=@Gentoo-1,compress=lzo

or:

kernel /boot/kernel-x86_64-3.12.0-gentoo-LZO root=PARTUUID=4edab2c4-1c33-4c41-b4b0-133eee1f0a0d rootfstype=btrfs rootflags=device=/dev/sda2,device=/dev/sdb2,compress=lzo,subvol=@Gentoo-1

or:

kernel /boot/kernel-x86_64-3.12.0-gentoo-LZO root=/dev/sdb2 rootfstype=btrfs rootflags=device=/dev/sda2,device=/dev/sdb2,subvol=@Gentoo-1,compress=lzo
```

I always get a kernel panic with this description for the first two of the above kernel command lines:

 *Quote:*   

> 
> 
> btrfs: device label RAID-1 devid 2 transid 540 /dev/sdb2
> 
> btrfs: use lzo compression
> ...

 

for the last both command lines I got:

 *Quote:*   

> 
> 
> VFS: Cannot open root device" My used Name" or unknown-block (ep): error-2
> 
> Please append a correct "root=" boot option; here are the available partitions:

 

I tried lots off different combinations , but none works, the errors are mostly like this two from above.

And for completion here are some different fstab entries I also used in combination with the above listed grub entries, I'm not really sure if there is a negative interaction between, for mounting root?

```
LABEL=RAID-1            /               btrfs   device=/dev/sda2,device=/dev/sdb2,defaults,relatime,subvol=@Gentoo-1,compress=lzo,autodefrag   0 1

#LABEL=RAID-1           /               btrfs   defaults,relatime,subvol=@Gentoo-1,compress=lzo,autodefrag       0 1
```

So any help is much appreciated if you don't recommend or discuss  why I'm not willing to use GRUB2 or initramfs   :Wink: 

[Edit]

Forget to mention some of my eventually relevant kernel parameters:

```
CONFIG_HAVE_KERNEL_LZO=y

# CONFIG_KERNEL_LZO is not set

# CONFIG_SQUASHFS_LZO is not set

CONFIG_CRYPTO_LZO=y

CONFIG_LZO_COMPRESS=y

CONFIG_LZO_DECOMPRESS=y

CONFIG_BTRFS_FS=y

# CONFIG_BTRFS_FS_POSIX_ACL is not set

# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set

# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set

# CONFIG_BTRFS_DEBUG is not set

# CONFIG_BTRFS_ASSERT is not set

# CONFIG_RAID_ATTRS is not set

CONFIG_RAID6_PQ=y
```

I guess the root cause is the wrong syntax for telling the kernel the right devices, to assemble the btrfs raid from (sda2, sdb2), but how?

Best, Andy.

----------

## Maitreya

Somebody supplied patches in this topic :

https://forums.gentoo.org/viewtopic-t-923554-start-0.html

----------

## Randy Andy

Maitreya,

many thanks for the link to this kind of information. Now I know I'm not the only one.

Sadly the last posts are nearly one year old and now I'm trying to get it work under kernel-3.12.0, the btrfs-tools are also improved regarding some features.

Is it still necessary to patch the latest kernel, to get it work? 

That's not my preferred way.   :Rolling Eyes: 

One reason why I fiddle around for hours with all possible combinations of command line parameter, was the information given here at the end:

https://btrfs.wiki.kernel.org/index.php/Using_Btrfs_with_Multiple_Devices

 *Quote:*   

> 
> 
> All these options can also be set from the kernel command line, through root=/fstype=/rootflags=. 

 

which doesn't work at all, as it seems to me.

If someone knows newer ambitions, pointing into this direction, please let me know.

Best, Andy.

----------

