Linux LVM users
 help / color / mirror / Atom feed
From: Luca Berra <bluca@comedia.it>
To: Christophe Saout <christophe@saout.de>
Cc: linux-lvm@sistina.com
Subject: Re: [linux-lvm] booting a dm+lvm2 kernel
Date: Thu Jan  1 16:47:01 2004	[thread overview]
Message-ID: <20040101224529.GD21031@percy.comedia.it> (raw)
In-Reply-To: <1072993242.6220.12.camel@leto.cs.pocnet.net>

On Thu, Jan 01, 2004 at 10:40:42PM +0100, Christophe Saout wrote:
>Sorry for interrupting your discussion, but if someone is modifying the
>initrd script to work with LVM2 or writing a new one, I've perhaps some
>inspiration.
I modified mkinitrd for Mandrake Linux, which is in turn based on
redhat's one. I tkink my code is production stable, but i could still be
contraddicted

Redhat(fedora) is also doing a similar thing. I believe to have started
earlier, then merged in some code from fedora...

>So I modified my initrd to used pivot_root to mount the root filesystem
>itself. I can now give root=/dev/vg/root directly as parameter to the
>kernel instead of having to rely on lilo to resolve the numeric
>major:minor (that caused the trouble).

I always use pivot root in case i am using lvm, but i get the LV name
from fstab when creating the initrd image, i do not trust lilo as well,
i did not have your problem, but i had to test switching from lvm1 to
dm, and did not love lilo hardcoding the wrong MAJOR number. How do you
get the "root=/dev/vg/root", by parsing the last occurrence in
/proc/cmdline?

>The only backdraw: If there isn't an /initrd on the root filesystem,
I used to forcibly create /initrd during the mkinitrd script, i don't do
it anymore since /initrd is part of mandrake filesystem package

>I also switched to ash as shell (a very small bourne-compatible shell).
Atm i am using a modified redhat nash, another option would be busybox
(nash is a very minimal command parser designed with initrd in mind)

>And I added udev to the initrd. The static /dev entries on the initrd
>are only the basic ones, like /dev/console, /dev/null and so.
>/dev/mapper/initrd is created dynamically using /proc/misc, and the
>existing block devices are created using udev and /sys/block/* (if /dev
>isn't devfs).
udev was on my todo list, but i never got there, i'll take a look at
what you did.
I don't copy any device file in the initrd at the moment. I create device
nodes if i need them in nash (and lvm tools), and it suffices my
purposes.

>a) look whether a 2.4 or 2.6 kernel is used and if udev is available (if
see above

>b) look for a small shell that is bourne-compatible (/bin/ash if found,
see above

>c) if LVM2 is used add dynamic /dev/mapper/control detection and use
>lvm2 tool, use lvm1 else
i already do this

>d) try to use pivot_root if available and/or write the recognized
>major:minor to /proc/sys/kernel/real-root-dev
pivot_root is cleaner

>e) use partial activation mode if available
this is a good idea

>f) figure out the used binaries and libraries and copy them (just like
>the old initrd does) and strip them
all the tools i use are linked with dietlibc (on arches that support
it), for the other i already detect the needed libraries, look at my
code.

>g) add the possibility to load modules
i already do this

My initrd detects if the root VG is on a md (softraid) device and
starts it before trying to activate the VG.

I also deal with a readonly initrd (read cramfs), by mounting /dev
(devfs or tmpfs) at the beginning of linuxrc and /etc (tmpfs) before
calling vgscan for lvm1.

Btw, in lilo i use your patch but i tested opening /dev/mapper/control
before trying to initialize dm() so users won't see an error if they
don't have dm in their kernel.

Regards,
L.

-- 
Luca Berra -- bluca@comedia.it
        Communication Media & Services S.r.l.
 /"\
 \ /     ASCII RIBBON CAMPAIGN
  X        AGAINST HTML MAIL
 / \

  reply	other threads:[~2004-01-01 16:47 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-01 10:58 [linux-lvm] booting a dm+lvm2 kernel Kjartan Reynir Hauksson
2004-01-01 12:49 ` Luca Berra
2004-01-01 15:42   ` Christophe Saout
2004-01-01 16:47     ` Luca Berra [this message]
2004-01-02  8:30       ` Christophe Saout
2004-01-01 17:40         ` Luca Berra
2004-01-01 17:50           ` Christophe Saout
2004-01-01 17:05   ` [linux-lvm] LVM2 on boot partition Branko
  -- strict thread matches above, loose matches on Subject: below --
2004-01-03 11:34 [linux-lvm] booting a dm+lvm2 kernel Kjartan Reynir Hauksson
2004-01-05  7:32 ` Luca Berra
2004-01-02 18:02 Kjartan Reynir Hauksson
2004-01-03  4:30 ` Luca Berra
2004-01-02 16:54 Kjartan Reynir Hauksson
2004-01-02 17:34 ` Luca Berra
2004-01-02 13:40 Kjartan Reynir Hauksson
2004-01-02 14:12 ` Luca Berra
2004-01-02 14:24   ` Bill Rugolsky Jr.
2004-01-02 16:11     ` Luca Berra
2004-01-02 13:03 Kjartan Reynir Hauksson
2004-01-02 13:15 ` Luca Berra
2004-01-02 11:37 Kjartan Reynir Hauksson
2004-01-02 12:07 ` Luca Berra
2004-01-02  9:12 Kjartan Reynir Hauksson
2004-01-02 10:58 ` Luca Berra
2003-12-31 18:46 Kjartan Reynir Hauksson
2004-01-01  5:11 ` Luca Berra
2003-12-30 21:21 Kjartan Reynir Hauksson
2003-12-31  3:35 ` Luca Berra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040101224529.GD21031@percy.comedia.it \
    --to=bluca@comedia.it \
    --cc=christophe@saout.de \
    --cc=linux-lvm@sistina.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox