[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Little OT] grub and udev root device



On Wed, Aug 02, 2006 at 04:04:57PM -0700, Hemlock wrote:
> I'm wondering if its possible to rename my / device with udev and get grub 
> to see it and boot it?
> Here's what I tried:
> 
> kernel 2.6.17
> 
> /etc/udev/rules.d/010local.rules
> 
> BUS="scsi", ID="0:0:0:0", NAME="sata%n"
> 
> I have one partition on my sata drive so I edited fstab
> to mount / on to /dev/sata1 instead of /dev/sda1
> 
> I then edited grub and changed root=/dev/sda1 to root=/dev/sata1
> I also made a new initrd image just in case:
> 
> # mkinitrd -o /boot/initrd.img-2.6.17sata -r /dev/sata1
>      (I edited the grub menu too to use the new initrd.img)
> 
> If I reboot, I get a kernel panic, something about cannot open dev/console
>    attempted to kill init
> 
> If I reboot again and edit the grub boot loader and point the root back 
> to /dev/sda1, the system boots fine, although a 
> # df -h 
> shows / mounted to /dev/sata1
> 
> Is it even possible to boot off a customly named root device?

Does whatever your mkinitrd is, know to use the udev rules when mounting
the root device?  Remember that internall the kernel has a concept of
what devices are to be named and it is that internal name that root= for
the kernel uses.  Just because you think it should be named sata doesn't
mean the kernel's internal name for a scsi block device is going to
change.  You could always mount root by label instead I suppose, in
which case it doesn't care waht it is named.

So your rename changes what /dev shows (due to udev) and is probably
what changes what mount shows, but the actual mounting of root is still
done by major/minor using the kernel's internal table of device names.

I think trying to rename something as key as your root device is
probably going to cause no end of trouble unless you start mounting the
root filesystem by label or UUID rather than device name.

--
Len Sorensen



Reply to: