Re: [gentoo-user] Mounting the rootfs by UUID?

2011-01-21 Thread Daniel Pielmeier
Nils Larsson :
> On Friday 21 January 2011 04:09:12 walt wrote:
>> Has anyone managed to use that UUID feature to tell the kernel where to
>> find the rootfs?
>
> You have to use a initramfs, see:
> http://en.gentoo-wiki.com/wiki/Initramfs#UUID.2FLABEL_Root_Mounting

Starting from kernel-2.6.37 [1,2] this is possible without an intramfs

[1] 
http://kernelnewbies.org/Linux_2_6_37#head-da4cb5f727d0f3b8fac1b23c097e15c3b49ff793
[2] 
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=b5af921ec02333e943efb59aca4f56b78fc0e100

-- 
Daniel Pielmeier



Re: [gentoo-user] Mounting the rootfs by UUID?

2011-01-21 Thread Nils Larsson
On Friday 21 January 2011 04:09:12 walt wrote:
> Has anyone managed to use that UUID feature to tell the kernel where to
> find the rootfs?

You have to use a initramfs, see:
http://en.gentoo-wiki.com/wiki/Initramfs#UUID.2FLABEL_Root_Mounting



[gentoo-user] Mounting the rootfs by UUID?

2011-01-20 Thread walt

This is a followup to my grub2 thread, which got a bit too long for comfort.

I actually have grub2 installed and working properly, so it's very do-able.
But the main point (for me) was grub2's ability to find partitions by LABEL.

That is, if you know the LABEL of the boot partition, grub2 is guaranteed to
find and load the kernel from that partition, no matter how the BIOS juggles
and shuffles disk numbers as you plug and unplug USB drives.

That feature of grub2 is rilly kool, and all that, but the next problem is
how to tell your cleverly-located-and-booted kernel what partition to mount
as the root filesystem.  That's where those dreaded kernel panics come from,
when the kernel can't find the device number that was hard-coded into it when
you compiled it.

The usual way to override that hard-wired device number is to give the kernel
the "root=/dev/" boot parameter in your grub menu.lst.

But, if you have some arbitrary number of USB disks plugged into your machine,
you have no way of knowing in advance what the correct /dev/ is going to
be. Your BIOS is going to shuffle those device numbers around however it likes.

Sadly, there is no kernel boot parameter (yet) that will accept the LABEL of
the rootfs.  But there is (maybe?) a kernel parameter that will accept the UUID
of the rootfs instead of /dev/ or LABEL.

The problem is, I can't get it to work -- the kernel still panics when I give
it a UUID instead of /dev/.

(Note that I'm *not* referring to /etc/fstab, where you can easily use UUID, or
LABEL, or /dev/, as you please.  But if the kernel can't find the partition
where /etc/fstab lives (the rootfs) the kernel can't read it, right?)

I've found references (even in the grub2 wiki) about passing root=UUID=
on the kernel parameter line (instead of in /etc/fstab) but that doesn't work
for me.

If you read /usr/src/linux/init/do_mounts.c (for kernels >= 2.6.37) you will
see that the code is looking for the string "PARTUUID=" instead of "UUID=", so
I've tried that also.  Kernel panic again.

Has anyone managed to use that UUID feature to tell the kernel where to find
the rootfs?

Beat me with the cluestick, please!