I'm having some trouble understanding which drive identifiers are available at different stages of system boot.
I'm running a Pi 2B with a btrfs root mounted on an external USB SSD. I'd like to address the root fs by PARTUUID rather than kernel name descriptor in case USB storage plug order ever changes but I'm having a hard time getting bootup working.
I've built an initrd.img containing neccessary btrfs modules; bootup is fine using /dev/XdXn but PARTUUID naming fails every time and dumps me out into busybox. initrd.img is setup in config.txt using "initramfs initrd.img-4.9.24-v7+ followkernel".
Note: / is mounted on a subvolume of the btrfs volume named ROOT.
This boots:
root@Tree-Eater:/etc# cat /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=tty1 root=/dev/sda2 rootfstype=btrfs rootflags=subvol=ROOT elevator=deadline rootwait rootdelay=5 quiet splash plymouth.ignore-serial-consoles
This fails:
root@Tree-Eater:/etc# cat /boot/cmdline.uuid
dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=be046359-02 rootfstype=btrfs rootflags=subvol=ROOT elevator=deadline rootwait rootdelay=5 quiet splash plymouth.ignore-serial-consoles
Relevant fs & block device info below, any thoughts?
root@Tree-Eater:/etc# cat /etc/fstab
proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat defaults 0 2
LABEL=external_btrfs / btrfs defaults,space_cache,ssd,noatime,nodiratime,subvol=ROOT 0 0
LABEL=swappy /swap ext4 defaults,noatime,nodiratime 0 2
# btrfs fs root for snapshots
LABEL=external_btrfs /mnt/btrfs btrfs defaults,noauto,space_cache,ssd,noatime,nodiratime 0 0
/dev/mmcblk0p2 /mnt/sdroot ext4 defaults,noatime,nodiratime,noauto 0 0
root@Tree-Eater:/etc# lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sda
├─sda2 btrfs external_btrfs b21e0b28-05d1-4518-a4c9-77cacdf83d08 /mnt/btrfs
└─sda1 ext4 swappy 74ac5717-c894-4d16-97e2-78a07bb219e3 /swap
mmcblk0
├─mmcblk0p2 ext4 2f840c69-cecb-4b10-87e4-01b9d28c231c /mnt/sdroot
└─mmcblk0p1 vfat boot 2D2D-CD16 /boot
root@Tree-Eater:/etc# blkid -o export
DEVNAME=/dev/mmcblk0p1
SEC_TYPE=msdos
LABEL=boot
UUID=2D2D-CD16
TYPE=vfat
PARTUUID=d660c869-01
DEVNAME=/dev/mmcblk0p2
UUID=2f840c69-cecb-4b10-87e4-01b9d28c231c
TYPE=ext4
PARTUUID=d660c869-02
DEVNAME=/dev/sda1
LABEL=swappy
UUID=74ac5717-c894-4d16-97e2-78a07bb219e3
TYPE=ext4
PARTUUID=be046359-01
DEVNAME=/dev/sda2
LABEL=external_btrfs
UUID=b21e0b28-05d1-4518-a4c9-77cacdf83d08
UUID_SUB=d2439418-1cc2-47d4-9e36-3598de7fb75b
TYPE=btrfs
PARTUUID=be046359-02
DEVNAME=/dev/mmcblk0
PTUUID=d660c869
PTTYPE=dos
root@Tree-Eater:/etc# btrfs subvolume show /
/
Name: ROOT
UUID: db80ba63-dc08-bc42-8f65-ce0caee0cae1
Parent UUID: -
Received UUID: -
Creation time: 2017-05-22 00:09:26 -0700
Subvolume ID: 257
Generation: 4829
Gen at creation: 6
Parent ID: 5
Top level ID: 5
Flags: -
Snapshot(s):
ROOT-2017-05-23_08:15
be046359-02
blkid -o export
shows all of the proper ids and labels for everything.