[clue-tech] LVM device major number.

David L. Anselmi anselmi at anselmi.us
Sun Sep 3 00:50:42 MDT 2006


Where does LVM (dm_mod) get its major number from?  (Below applies to 
Debian testing with the root partition on a logical volume on software 
RAID 1.)

We've all recovered a boot record by booting off a CD (live, rescue, 
whatever), mounting the root hard drive partition, and running lilo or 
grub.  That doesn't seem to be a sure thing if the root partition is LVM.

I upgraded my kernel and initramfs-tools and the box doesn't boot 
anymore--kernel panic because it can't find root.  There didn't seem to 
be any errors from the upgrade, which would have rebuilt the initrd and 
rerun lilo.

I made a mistake in not looking closely enough at the cause, just 
assumed it couldn't find the initrd (that may have been the problem but 
if it wasn't it would have been easier to fix).  So I put in Knoppix, 
rebuilt the initrd and ran lilo (yeah, have to activate md0 and then the 
volume group to get at the lilo.conf).  Now the box loads the initrd but 
can't find its root device so it quits at a busybox prompt (like being 
in the 60's).

The problem is that Knoppix gives dm devices a major of 254 but my 
kernel uses 253.  Lilo insists on having the right /dev entries but that 
means numbers that work with the Knoppix kernel that's running lilo.

So lilo puts 254 in root= that it passes to my kernel.  My kernel has 
given dm 253 and then goes looking for 254 (it creates /dev/root with 
the number from the command line and tries to mount that).  (The number 
goes in /boot/map but I didn't try changing it there--maybe that would 
have worked).

The fix?  Boot a Kubuntu CD that happens to use 253 for dm and run lilo 
from there.

So what determines the major number dm_mod uses?  I wonder how many 
distros are at risk for breaking during a kernel upgrade?  (My hope is 
that this is more deterministic than it seems.)  I did read that 
Fedora's kernel used a different number than a vanilla kernel, and 
installs on a root LV, so booting off a vanilla kernel is difficult.[1]

Lilo doesn't let you pick different numbers for different kernels, so if 
the kernel packagers for each distro don't have control over it they may 
run into problems.  I did find mention that lilo might be confused if 
the system was different during "map installation" than during boot, and 
that's exactly what this is.[2]

  1. http://www.fi.muni.cz/~kas/blog/index.cgi/ \
     computers/fedora-vanilla-kernel.html -- too bad the fix isn't
     described
  2. http://ourworld.compuserve.com/homepages/KanjiFlash/Notes.htm

Dave



More information about the clue-tech mailing list