Linux – How to identify root partition via UUID without initramfs/initrd

bootgrubkernellinuxuuid

Without initramfs/initrd support, the following kernel command line won't work:

linux   /bzImage root=UUID=666c2eee-193d-42db-a490-4c444342bd4e ro

How can I identify my root partition via UUID without the need for an initramfs/initrd?

I can't use a device name like /dev/sda1 either, because the partition resides on a USB-Stick and needs to work on different machines.

Best Answer

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.

Related Question