Gentoo Archives: gentoo-user

From: walt <w41ter@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Mounting the rootfs by UUID?
Date: Fri, 21 Jan 2011 03:11:18
Message-Id: ihatcu$gr9$1@dough.gmane.org
1 This is a followup to my grub2 thread, which got a bit too long for comfort.
2
3 I actually have grub2 installed and working properly, so it's very do-able.
4 But the main point (for me) was grub2's ability to find partitions by LABEL.
5
6 That is, if you know the LABEL of the boot partition, grub2 is guaranteed to
7 find and load the kernel from that partition, no matter how the BIOS juggles
8 and shuffles disk numbers as you plug and unplug USB drives.
9
10 That feature of grub2 is rilly kool, and all that, but the next problem is
11 how to tell your cleverly-located-and-booted kernel what partition to mount
12 as the root filesystem. That's where those dreaded kernel panics come from,
13 when the kernel can't find the device number that was hard-coded into it when
14 you compiled it.
15
16 The usual way to override that hard-wired device number is to give the kernel
17 the "root=/dev/xxxx" boot parameter in your grub menu.lst.
18
19 But, if you have some arbitrary number of USB disks plugged into your machine,
20 you have no way of knowing in advance what the correct /dev/xxxx is going to
21 be. Your BIOS is going to shuffle those device numbers around however it likes.
22
23 Sadly, there is no kernel boot parameter (yet) that will accept the LABEL of
24 the rootfs. But there is (maybe?) a kernel parameter that will accept the UUID
25 of the rootfs instead of /dev/xxxx or LABEL.
26
27 The problem is, I can't get it to work -- the kernel still panics when I give
28 it a UUID instead of /dev/xxxx.
29
30 (Note that I'm *not* referring to /etc/fstab, where you can easily use UUID, or
31 LABEL, or /dev/xxxx, as you please. But if the kernel can't find the partition
32 where /etc/fstab lives (the rootfs) the kernel can't read it, right?)
33
34 I've found references (even in the grub2 wiki) about passing root=UUID=<uuid>
35 on the kernel parameter line (instead of in /etc/fstab) but that doesn't work
36 for me.
37
38 If you read /usr/src/linux/init/do_mounts.c (for kernels >= 2.6.37) you will
39 see that the code is looking for the string "PARTUUID=" instead of "UUID=", so
40 I've tried that also. Kernel panic again.
41
42 Has anyone managed to use that UUID feature to tell the kernel where to find
43 the rootfs?
44
45 Beat me with the cluestick, please!

Replies

Subject Author
Re: [gentoo-user] Mounting the rootfs by UUID? Nils Larsson <nisselarsson@××××.se>