this patch is need for btrfs raid1 rootfs, since raid1 rootfs need to run "btrfs device scan" this patch basically doing following 1) copy btrfs utils into initramfs 2) run "btrfs device scan" for the btrfs root Reproducible: Always
Created attachment 356052 [details, diff] add boot support for raid1 btrfs rootfs
btrfs raid1 use multi physical devices, and according to this[1], device scan operation is required. also see bug [2] btw, I didn't go for the "udev rules" way, simply "btrfs device scan" is just enough [1] https://btrfs.wiki.kernel.org/index.php/Using_Btrfs_with_Multiple_Devices#Device_scanning [2] https://bugzilla.redhat.com/show_bug.cgi?id=581204
I think that the udev rules is the way to go. I don't like the way you implemented it in linuxrc, while I am fine (thanks!) about the gen_initramfs* stuff (besides the missing udev rules). I will have a look at this in the next days.
Ok, I just realized that there is no btrfs udev rules in btrfs-progs
1. why should I copy mkfs.btrfs to initramfs? 2. isn't btrfsctl -a enough? 3. what is the output of blkid "<your root device containing btrfs>"? 4. you forgot to add --btrfs to doc/genkernel.8.txt I am merging parts of your work anyway (**parts** and in a different way). Please update your git checkout, since it's more than a week old.
I see that btrfsctl is deprecated in favour of btrfs. Cool.
Can you test the latest genkernel-next git HEAD and see if it works out of the box? There is no need to append BTRFS= to root= (or real_root=). "btrfs device scan" should be executed in case the filesystem type of "${REAL_ROOT}" is "btrfs". Please run without "quiet" in your kernel command line and post the output here in case of problems (a photo will do as well).
(In reply to Fabio Erculiani from comment #5) > 1. why should I copy mkfs.btrfs to initramfs? not necessary .. feel free to remove it as you like thought it would be helpful it need to reformat, fsck (also the tool btrfsck) > 2. isn't btrfsctl -a enough? yes, you realized that later, running "btrfs device scan" is enough > 3. what is the output of blkid "<your root device containing btrfs>"? I'm not at my desktop, yes, my rootfs using btrfs (raid1) > 4. you forgot to add --btrfs to doc/genkernel.8.txt yes, feel free to add this (I'd appreciate people working for me ;-) > > I am merging parts of your work anyway (**parts** and in a different way). > Please update your git checkout, since it's more than a week old. yes, feel free to adjust the code as your need, I'm just providing a primary prototype. I'll test tomorrow, and will let me know
Created attachment 356400 [details, diff] add --btrfs command line one miror problem. you forget to add "--btrfs,--no-btrfs" command option? (since you add helps to doc) or maybe you can make the copy operation magically base on the detection of /sbin/btrfs. like you auto detect the filesytem type. and, it's your choice here.. # genkernel --btrfs Error: Unknown option '--btrfs'! and fail to populate "/sbin/btrfs" into initramfs, thus it's broken.. and with this patch applied, my system boots sucessfully. thanks
Great! Thanks, committed. can you confirm that bklid <device> returns "btrfs" for the TYPE field? commit 9b47f9b5d21f0bcbfaa75f3f920be124a96e8f65 Author: Fabio Erculiani <lxnay@sabayon.org> Date: Mon Aug 19 10:32:01 2013 +0200 gen_cmdline: eventually add --btrfs and --no-btrfs cmdline support Thanks to Dennis 'dlan' Lan via bug #481116
(In reply to Fabio Erculiani from comment #10) > Great! Thanks, committed. > can you confirm that bklid <device> returns "btrfs" for the TYPE field? > > commit 9b47f9b5d21f0bcbfaa75f3f920be124a96e8f65 > Author: Fabio Erculiani <lxnay@sabayon.org> > Date: Mon Aug 19 10:32:01 2013 +0200 > > gen_cmdline: eventually add --btrfs and --no-btrfs cmdline support > > Thanks to Dennis 'dlan' Lan via bug #481116 Yes, this works # blkid -o value -s TYPE /dev/sdb1 btrfs and this is part of my boot log (you may instrereted in ) ---- :: Loading from nee1000: Intel(R) PRO/1000 Network Driver - version 7.3.21-k8-NAPI t: e1000: Copyright (c) 1999-2006 Intel Corporation. e1000 pps_core: LinuxPPS API ver. 1 registered pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it> PTP clock support registered tg3 :: Loading from iscsi: Loading iSCSI transport class v2.0-870. scsi_transport_iscsi libiscsi :: Loading from crypto: sha1_generic sha256_generic sha512_generic aes-x86_64 xts :: Loading from virtio: >> Initializing root device... usb 3-1: new low-speed USB device number 2 using uhci_hcd >> Initializing /dev/sda2 if needed, detected fstype: btrfs Scanning for Btrfs filesystems device label root devid 4 transid 6871 /dev/sdb1 device label proj devid 3 transid 1011 /dev/sdb2 device label home devid 1 transid 6147 /dev/sdc1 usb 3-1: New USB device found, idVendor=413c, idProduct=2106 usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 device label home devid 2 transid 6147 /dev/sdd1 usb 3-1: Product: Dell QuietKey Keyboard usb 3-1: Manufacturer: Dell device label proj devid 2 transid 1011 /dev/sdd2 input: Dell Dell QuietKey Keyboard as /devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1:1.0/input/input0 hid-generic 0003:413C:2106.0001: input,hidraw0: USB HID v1.10 Keyboard [Dell Dell QuietKey Keyboard] on usb-0000:00:1a.0-1/input0 device label root devid 2 transid 6871 /dev/sda2 device label proj devid 1 transid 1011 /dev/sda3 >>REISERFS warning (device sda2): super-6502 reiserfs_getopt: unknown mount option "compress=zlib" Mounting /dev/sda2 as root... >> Using mount -t auto -o ro,compress=zlib,device=/dev/sda2,device=/dev/sdb1 UDF-fs: bad mount option "compress=zlib" or missing value XFS (sda2): unknown mount option [compress]. (mount,2706,3):ocfs2_parse_options:1510 ERROR: Unrecognized mount option "compress=zlib" or missing value (mount,2706,3):ocfs2_fill_super:1230 ERROR: status = -22 device label root devid 2 transid 6871 /dev/sda2 device label root devid 4 transid 6871 /dev/sdb1 device label root devid 2 transid 6871 /dev/sda2 btrfs: use zlib compression btrfs: disk space caching is enabled usb 3-2: new low-speed USB device number 3 using uhci_hcd mountpoint: applet not found usb 3-2: New USB device found, idVendor=0461, idProduct=4d22 usb 3-2: New USB device strings: Mfr=0, Product=2, SerialNumber=0 usb 3-2: Product: USB Optical Mouse input: USB Optical Mouse as /devices/pci0000:00/0000:00:1a.0/usb3/3-2/3-2:1.0/input/input1 hid-generic 0003:0461:4D22.0002: input,hidraw1: USB HID v1.11 Mouse [USB Optical Mouse] on usb-0000:00:1a.0-2/input0 mountpoint: applet not found >> Booting (initramfs) INIT: version 2.88 booting usb 6-2: new full-speed USB device number 2 using uhci_hcd usb 6-2: New USB device found, idVendor=067b, idProduct=2303 usb 6-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 usb 6-2: Product: USB-Serial Controller usb 6-2: Manufacturer: Prolific Technology Inc.
> device label root devid 2 transid 6871 /dev/sda2 > device label proj devid 1 transid 1011 /dev/sda3 > >>REISERFS warning (device sda2): super-6502 reiserfs_getopt: unknown mount option "compress=zlib" > Mounting /dev/sda2 as root... > >> Using mount -t auto -o ro,compress=zlib,device=/dev/sda2,device=/dev/sdb1 > UDF-fs: bad mount option "compress=zlib" or missing value > XFS (sda2): unknown mount option [compress]. > (mount,2706,3):ocfs2_parse_options:1510 ERROR: Unrecognized mount option > "compress=zlib" or missing value > (mount,2706,3):ocfs2_fill_super:1230 ERROR: status = -22 > device label root devid 2 transid 6871 /dev/sda2 > device label root devid 4 transid 6871 /dev/sdb1 > device label root devid 2 transid 6871 /dev/sda2 > btrfs: use zlib compression > btrfs: disk space caching is enabled > usb 3-2: new low-speed USB device number 3 using uhci_hcd also try to pass rootfstype=btrfs is still good, will avoid auto probe (mount with wrong fs)
I think that now we could stop using "auto" by default. Something like this: - use rootfstype= if specified - otherwise detect the fstype using blkid - if this fails, set fstype to "auto" and hope the kernel will be smarter However, the current zfs setup code made a big mess in genkernel initramfs scripts. Instead of letting the kernel detect the fstype (or using blkid) they did that weird thing with root=ZFS=... So sad.
(In reply to Fabio Erculiani from comment #13) > I think that now we could stop using "auto" by default. > Something like this: > - use rootfstype= if specified > - otherwise detect the fstype using blkid so we need to pass "-t btrfs" to mount command, when detected the file system > - if this fails, set fstype to "auto" and hope the kernel will be smarter > yeah, I like your plan here ;-) > However, the current zfs setup code made a big mess in genkernel initramfs > scripts. Instead of letting the kernel detect the fstype (or using blkid) > they did that weird thing with root=ZFS=... > > So sad. not aware this. I did the btrfs initial patch, and was following the ZFS way. I'm not using ZFS, and can't do anything here (and you are the maintainer!)
Anyway, this is now fixed.