Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] LVM2 on RAID1 with LILO, boot and root on LVM
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
ranger719
Tux's lil' helper
Tux's lil' helper


Joined: 16 May 2006
Posts: 92
Location: Germany

PostPosted: Fri Oct 19, 2007 11:59 am    Post subject: [SOLVED] LVM2 on RAID1 with LILO, boot and root on LVM Reply with quote

Hi all,
I am somehow stuck with lilo and my harddisk setup. All output here comes from a booted systemrescuecd (chrooted to my installation).

My disk is partitioned as follows:
Code:
fdisk -l

Disk /dev/hda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1       19457   156288352   fd  Linux raid autodetect

Disk /dev/md0: 160.0 GB, 160039174144 bytes
2 heads, 4 sectors/track, 39072064 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md0 doesn't contain a valid partition table


I have set up one big raided partition (mirrored, only one disk right now):
Code:

cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid6] [raid5] [raid4] [multipath] [raid10]
md0 : active raid1 hda1[0]
      156288256 blocks [2/1] [U_]

unused devices: <none>


After the raid was set up, I put an LVM2 on it:
Code:
pvscan
  /newroot/sys/block: opendir failed: No such file or directory
  PV /dev/md0   VG data   lvm2 [149.05 GB / 920.00 MB free]
  Total: 1 [149.05 GB] / in use: 1 [149.05 GB] / in no VG: 0 [0   ]

and
Code:
lvscan
  ACTIVE            '/dev/data/boot' [52.00 MB] inherit
  ACTIVE            '/dev/data/swap' [512.00 MB] inherit
  ACTIVE            '/dev/data/rootfs' [10.00 GB] inherit
  ACTIVE            '/dev/data/tmp' [1.00 GB] inherit
  ACTIVE            '/dev/data/log' [512.00 MB] inherit
  ACTIVE            '/dev/data/rootusr' [100.00 MB] inherit
  ACTIVE            '/dev/data/stuff' [136.00 GB] inherit


So far so, good. As you see root and boot are both ON the LVM2 volume. So I have to use lilo to boot my machine. I know this works, Ubuntu 6.06LTS can do this.
Now my problem. I have the latest ~x86 lilo-version installed: 22.8-r1.
My lilo.conf:
Code:
cat /etc/lilo.conf
# $Header: /var/cvsroot/gentoo-x86/sys-boot/lilo/files/lilo.conf,v 1.2 2004/07/18 04:42:04 dragonheart Exp $
# Author: Ultanium

#compact
#lba32
boot = /dev/md0
map = /boot/map
raid-extra-boot = mbr-only
menu-scheme=Wb
prompt
timeout=10
vga = normal


image = /boot/bzImage
        label = Gentoo
        root = /dev/data/rootfs
        read-only

image = /boot/failsafe
        label = Failsafe
        root = /dev/data/rootfs
        read-only

Mounted devices when I run lilo (output comes from outside the chroot):
Code:
/dev/mapper/data-rootfs on /mnt/gentoo type ext3 (rw)
/dev/mapper/data-boot on /mnt/gentoo/boot type ext2 (rw)
none on /mnt/gentoo/proc type proc (rw)
/dev on /mnt/gentoo/dev type none (rw,bind)

I am able to run lilo (with the -H switch because only 1 of 2 raid-drives is installed) and it sets up the kernel. I can even boot the kernel, but the kernel panics because it cannot mount my root-partition. All the filesystems are built into the kernel, LVM and raid1-support is also built-in.
The kernel-panic:
Code:
...
raid1: raid set md0 active with 1 out of 2 mirrors.
md: ... autorun DONE
VFS: Cannot open root device "fb02" or unknown-block(251,2)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(251,2)

This is weird, it cannot access the root-device fb02. I do not know what fb02 is, BUT look here:
Code:
lilo -v -v -v -H
LILO version 22.8, Copyright (C) 1992-1998 Werner Almesberger
Development beyond version 21 Copyright (C) 1999-2006 John Coffman
Released 19-Feb-2007 and compiled at 13:34:12 on Oct 19 2007
Running Linux kernel 2.6.22.06-fd08 on i686

Warning: LBA32 addressing assumed
device-mapper major = 251
Warning: '/proc/partitions' does not match '/dev' directory structure.
    Name change: '/dev/dm-0' -> '/dev/data/boot'
Warning: Name change: '/dev/dm-1' -> '/dev/data/swap'
Warning: Name change: '/dev/dm-2' -> '/dev/data/rootfs'
Warning: Name change: '/dev/dm-3' -> '/dev/data/tmp'
Warning: Name change: '/dev/dm-4' -> '/dev/data/log'
Warning: Name change: '/dev/dm-5' -> '/dev/data/rootusr'
Warning: Name change: '/dev/dm-6' -> '/dev/data/stuff'
pf_hard_disk_scan: ndevs=1
  0300  5704210F  /dev/hda
Resolve invalid VolumeIDs
Resolve duplicate VolumeIDs
  0300  5704210F  /dev/hda
device codes (user assigned pf) = 0
device codes (user assigned) = 0
device codes (BIOS assigned) = 0
Filling in '/dev/hda' = 0x80
device codes (canonical) = 1
RAID info:  nr=1, raid=2, active=1, working=1, failed=0, spare=0
Warning: Partial RAID-1 install on active disks only; booting is not failsafe

md: RAIDset device 0 = 0x0301
Device 0x0301: BIOS drive 0x80, 255 heads, 19457 cylinders,
               63 sectors. Partition offset: 1 sectors.
Using Volume ID 5704210F on bios 80
RAID scan: geo_get: returns geo->device = 0x80 for device 0301
disk->start = 1         raid_offset = 0 (00000000)
Name: /dev/hda1  yields MBR: /dev/hda  (without primary partition check)
Using BIOS device code 0x80 for RAID boot blocks
raid_setup returns offset = 00000000  ndisk = 1
 BIOS   VolumeID   Device
  80    5704210F    0300
raid flags: at bsect_open  0x02
Reading boot sector from /dev/md0
Device 0x0301: BIOS drive 0x80, 255 heads, 19457 cylinders,
               63 sectors. Partition offset: 1 sectors.
Device 0x0301: BIOS drive 0x80, 255 heads, 19457 cylinders,
               63 sectors. Partition offset: 1 sectors.
map_create:  boot=0900  map=FB00
Warning: Unable to determine video adapter in use in the present system.
Using MENU secondary loader
Calling map_insert_data
Secondary loader: 18 sectors (0x3600 dataend).
bios_boot = 0x80  bios_map = 0x80  map==boot = 0  map S/N: 00000000
BIOS data check will include auto-suppress check

Boot image: /boot/bzImage
Device 0x0301: BIOS drive 0x80, 255 heads, 19457 cylinders,
               63 sectors. Partition offset: 1 sectors.
Setup length is 10 sectors.
Mapped 2893 sectors.
Added Gentoo *
    <dev=0xf0,hd=0,cyl=70,sct=219>
    "ro root=fb02"

Boot image: /boot/failsafe
Device 0x0301: BIOS drive 0x80, 255 heads, 19457 cylinders,
               63 sectors. Partition offset: 1 sectors.
Setup length is 10 sectors.
Mapped 2893 sectors.
Added Failsafe
    <dev=0xf0,hd=0,cyl=70,sct=250>
    "ro root=fb02"

 BIOS   VolumeID   Device
  80    5704210F    0300
do_md_install: MD_PARALLEL
  offset 00000000  /dev/hda
Map file size: 44032 bytes.
RAID offset entry 0  0x00000000
RAID offset entry 0  0x00000000
RAID offset entry 0  0x00000000
RAID offset entry 0  0x00000000
RAID offset entry 0  0x00000000
RAID offset entry 0  0x00000000
RAID offset entry 0  0x00000000
RAID offset entry 0  0x00000000
RAID offset entry 0  0x00000000
RAID offset entry 0  0x00000000
RAID offset entry 0  0x00000000
RAID offset entry 0  0x00000000
RAID offset entry 0  0x00000000
RAID offset entry 0  0x00000000
RAID offset entry 0  0x00000000
RAID offset entry 0  0x00000000
RAID device mask 0x0001
Reading boot sector from /dev/hda
Device 0x0300: BIOS drive 0x80, 255 heads, 19457 cylinders,
               63 sectors. Partition offset: 0 sectors.
Using Volume ID 5704210F on bios 80
Using s/n from device 0x80
/boot/boot.0300 exists - no boot sector backup copy made.
Failsafe check:  boot_dev_nr = 0x0300 0xffffffc0
map==boot = 0    map s/n = 5704210F
The Master boot record of  /dev/hda  has been updated.
10 warnings were issued.

You can see this
Code:
Added Gentoo *
    <dev=0xf0,hd=0,cyl=70,sct=219>
    "ro root=fb02"
But my lilo.conf is correct, it just maps the given names to this? And then the kernel panics because the device does not exist?

One last note: the stable lilo-version does not work (22.7.3-r1 gives me this: Fatal: Linux experimental device 0x04x needs to be defined. Check 'man lilo.conf' under 'disk=' and 'max-partitions=') and the Ubuntu6.06LTS binary works, but does the same as the unstable. And it does not matter if #compact or #lba32 are set in lilo.conf.

Please help :) Thank you.

//EDIT
Kernel is linux-2.6.21-hardened-r3 (gentoo-hardened), right now I am compiling 2.6.22-hardened-r6

Major/Minor-number of Devicemaper and the kernel-panic-output are correct:
Code:
dmsetup info
...
Name:              data-rootfs
State:             ACTIVE
Tables present:    LIVE
Open count:        1
Event number:      0
Major, minor:      251, 2
Number of targets: 1
UUID: LVM-2sfjSSEalZKRe8adslQzgxJGUltZd0bSFavg0kElICRcAs9EC16jpspCIiyUbmI
...


//EDIT2:
Ubuntu does the same with the device-name "root=fd02", (not fb02) but there it works. But it does not complain about inconsistent /proc/partitions and /dev. I do not know how to fix this.

//EDIT3:
The new kernel gives:
Code:
...
md: ... autorun DONE
VFS: Cannot open root device "fd02" or unknown-block(253,2)
Please append a correct "root=" boot option; here are the available partitions:
0300  156290904 hda driver: ide-disk
  0301   156288352 hda1
0900 156288256 md0 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(253,2)

Now it is fd02, not fb02. No idea why.


Last edited by ranger719 on Fri Oct 19, 2007 10:32 pm; edited 1 time in total
Back to top
View user's profile Send private message
ranger719
Tux's lil' helper
Tux's lil' helper


Joined: 16 May 2006
Posts: 92
Location: Germany

PostPosted: Fri Oct 19, 2007 10:31 pm    Post subject: Reply with quote

I somehow wondered all the time how the kernel handles the logical volumes from my LVM. And then I got it: It doesn't! I need a ramdisk with LVM-userlandtools ;)

So, read this: http://gentoo-wiki.com/HOWTO_Install_Gentoo_on_an_LVM2_root_partition and you will get it done.
And one other thing: I did not set up a new stage3-installation. I was migrating from an old installation. I copied eversthing just over. Except /dev /proc and /sys. The directories are filled with content from udev and the kernel. Yes... except that a kernel NEEDS /dev/console and /dev/zero. If you don't have them, init will abort and say something about missing dev/console and the kernel panics with "blah killed init!".
Create them with mknod:
Code:
mknod -m 600 /dev/console c 5 1
mknod -m 666 /dev/null c 1 3


I also renamed the thread, lilo works just fine. I just needed the LVM-userlandtools in a ramdisk.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum