How to identify root partition via UUID without initramfs/initrd
I found the answer burried in another thread:
A UUID identifies a filesystems, whereas a PARTUUID identifies a partition (i.e. remains intact after reformatting). Without initramfs/initrd the kernel only supports PARTUUID.
To find the PARTUUID of the block devices in your machine use
sudo blkid
This will print, for example
/dev/sda1: UUID="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" TYPE="ext2" PARTUUID="f3f4g3f4-02"
You can now modify you linux command line as follows:
linux /bzImage root=PARTUUID=f3f4g3f4-02 ro
This will boot from the partition with PARTUUID f3f4g3f4-02, which in this case is /dev/sda1
.
lsblk
with various options can show you what disk/partition/uuid are in use
eg
% sudo lsblk -o UUID,PARTUUID,NAME,MOUNTPOINT
UUID PARTUUID NAME MOUNTPOINT
sda
d634adc8-69de-edd8-d491-a79e69aeff78 0008500a-01 |-sda1
195237da-8825-45fb-abf7-a62895bd0967 | `-md0 /boot
d2cf1bcc-d51d-bf37-9723-3b505172fe5f 0008500a-02 `-sda2
24bvXN-PVU1-kubI-Zgj5-W82i-3Z07-v80lME `-md1
67fe5039-de46-4629-bd03-ee65a5dd0132 |-godzilla-root /
ba70f1d1-89f0-4dd9-83a4-8bc9a74a6548 `-godzilla-swap [SWAP]
So I can see that UUID d634adc8-69de-edd8-d491-a79e69aeff78
corresponds to /dev/sda3
and partition UUID 0008500a-01
Depending on your setup you can then do
root=/dev/sda1
or
root=PARTUUID=0008600a-01
(In my case root
is part of an LVM and so can't be mounted this way, but the concept applies)