LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Booting btrfs usb-stick via uefi-bios. (http://www.linuxquestions.org/questions/linux-general-1/booting-btrfs-usb-stick-via-uefi-bios-4175467780/)

ssenuta 06-28-2013 09:50 PM

Booting btrfs usb-stick via uefi-bios.
 
Does anyone know how to boot a btrfs formated rootfs from a usb-stick partition (/dev/sdc2) using a uefi shell located on a
FAT-32 formated efi_sys partition (/dev/sdc1) ???

Here is my settup:
/dev/sdc1 ..efi_sys fat-32 formated partition
shellx64.efi ..uefi shell located on (fs2:/) of the efi_sys
usb.nsh ..uefi boot script located on (fs2:/) of the efi_sys
EFI ..directory
BOOT ..sub-directory
bzImage-3.9.0.efi ..kernel with UEFI & BTRFS support

/dev/sdc2 ..rootfs btrfs formated partition
(rootfs) ..a small filesystem I boot as a rescue disk

usb.nsh:
fs2:
bzImage-3.9.0.efi root=/dev/sdc2 ro selinux=0 plymouth.enable=0 raid=noautodetect single

Fstab for /dev/sdc2 rootfs:

#<device> <mnt.point> <type> <options> <dump> <pass>
/dev/sdc2 / btrfs defaults,noatune,autodefrag,noacl 0 0
#/dev/ram0 / btrfs defaults,noatune,autodefrag,noacl 0 0
/dev/pktcdvd0 /mnt/pktcdvd udf rw,noauto,noatime 0 0
/dev/sr0 /mnt/cdrw auto defaults,noauto 0 0
/dev/sdc1 /mnt/pendrive vfat defaults,noauto,noatime,flush 0 0

When I boot with the usb.nsh script,the kernel panics with:
Cannot open root device "sdc2" or unknown-block (0,0) Error 6

##############################################################################################
However, if I make a initramfs.gz of this same rootfs I can boot it as a btrfs ramdisk.
This setup looks like this:
/dev/sdc1 ..efi_sys fat-32 formated partition
shellx64.efi ..uefi shell located on (fs2:/) of the efi_sys
usb.nsh ..uefi boot script
EFI ..directory
BOOT ..sub-directory
bzImage-3.9.0.efi ..kernel with UEFI & BTRFS support
initramfs.rdz ..rootfs

/dev/sdc2 ..rootfs btrfs formated partition
(EMPTY)

usb.nsh:
fs2:
bzImage-3.9.0.efi root=/dev/ram0 rw selinux=0 plymouth.enable=0 raid=noautodetect single initrd=\EFI\BOOT\initramfs.gz

Fstab inside the initramfs.rdz:
#<device> <mnt.point> <type> <options> <dump> <pass>
#/dev/sdc2 / btrfs defaults,noatune,autodefrag,noacl 0 0
/dev/ram0 / btrfs defaults,noatune,autodefrag,noacl 0 0
/dev/pktcdvd0 /mnt/pktcdvd udf rw,noauto,noatime 0 0
/dev/sr0 /mnt/cdrw auto defaults,noauto 0 0
/dev/sdc1 /mnt/pendrive vfat defaults,noauto,noatime,flush 0 0


################################################################################################
Thanks for reading this post & I look forward to your replies.

ssenuta 06-29-2013 09:59 PM

################################################################################################
SOLVED 06/29/2013
################################################################################################

I am happy to inform you that I finally figured out why I couldn't UEFI boot my BTRFS formated usb-stick partition /dev/sdc2.

The usb-storage module had to be loaded (early) by an initrd.image rootfs so my kernel could find usb device /dev/sdc2.
I also had to change my /etc/fstab btrfs mount options as the "noatime" option wasn't recognized & add an "initrd" option
to my usb.nsh boot script.

Here is my working settup:
/dev/sdc1 ..efi_sys fat-32 formated partition
shellx64.efi ..uefi shell located on (fs2:/) of the efi_sys
usb.nsh ..uefi boot script located on (fs2:/) of the efi_sys
EFI ..directory
BOOT ..sub-directory
bzImage-3.9.0.efi ..kernel with UEFI & BTRFS support
initrd.img ..created via fedora-17 command: "dracut initrd.img 3.9.0-efi"

/dev/sdc2 ..rootfs btrfs formated partition
(rootfs) ..a small filesystem I boot as a rescue disk

usb.nsh:
fs2:
cd EFI\BOOT
bzImage-3.9.0.efi root=/dev/sdc2 ro selinux=0 plymouth.enable=0 raid=noautodetect single initrd=\EFI\BOOT\initrd.image

Fstab for /dev/sdc2 rootfs:
#<device> <mnt.point> <type> <options> <dump> <pass>
/dev/sdc2 / btrfs defaults 0 0
#/dev/sdc2 / btrfs defaults,noatune,autodefrag,noacl 0 0
#/dev/ram0 / btrfs defaults,noatune,autodefrag,noacl 0 0
/dev/pktcdvd0 /mnt/pktcdvd udf rw,noauto,noatime 0 0
/dev/sr0 /mnt/cdrw auto defaults,noauto 0 0
/dev/sdc1 /mnt/pendrive vfat defaults,noauto,noatime,flush 0 0

Good luck to anyone playing around with UEFI & Btrfs. I hope this post will help others with their problems.
Also, if you don't like using an initrd to boot you can probably just build the usb_storage.ko into your kernel.


All times are GMT -5. The time now is 11:15 AM.