All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-lvm] LVM partition and lvm commands in initrd
@ 2006-09-23  8:02 Mark Ryden
  2006-09-23  8:27 ` Aleksandr Koltsoff
  2006-09-23  8:56 ` Luca Berra
  0 siblings, 2 replies; 5+ messages in thread
From: Mark Ryden @ 2006-09-23  8:02 UTC (permalink / raw)
  To: linux-lvm

Hello linux-lvm,

  First, I am not an expert on LVM neither on initram disk (created
with mkinitrd).

  There is one point which I want to understand and I hope I can get
help here.

  I have Fedora Core 4 (on x386).
  fdisk -l shows that I have a Linux LVM partition.

  I opened the init file of the initrd on my machine
(initrd-2.6.11-1.1369_FC4.img).

  This script have some lvm commands , like:

  lvm vgscan --ignorelockingfailure
  lvm vgchange -ay --ignorelockingfailure VolGroup00

  It also has a call to mkdmnod (which creates  /dev/mapper/control ;
see man nash).

after boot, I see that I have the following (on: /):

/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)

The point which I want to understand is this:
Is existence of LVM partition is a MUST so that this script
will run and not cause panic on boot ?
Suppose I would NOT have an LVM partition.
(change its type with fdisk for example).

Will the calls to "lvm vgscan" and
  "lvm vgchange" and "mkdmnod" and insmoding the dm* modules will not
cause panic ?

any help will be appreciated.

Below here are the entry in grub.conf and the init script.



The entry in grub.conf is :

title Fedora Core (2.6.11-1.1369_FC4)
	root (hd0,1)
	kernel /vmlinuz-2.6.11-1.1369_FC4 ro root=/dev/VolGroup00/LogVol00
rhgb quiet nodma
	initrd /initrd-2.6.11-1.1369_FC4.img


init script of initrd: (initrd-2.6.11-1.1369_FC4.img)

#!/bin/nash

mount -t proc /proc /proc
setquiet
echo Mounted /proc filesystem
echo Mounting sysfs
mount -t sysfs /sys /sys
echo Creating /dev
mount -o mode=0755 -t tmpfs /dev /dev
mknod /dev/console c 5 1
mknod /dev/null c 1 3
mknod /dev/zero c 1 5
mkdir /dev/pts
mkdir /dev/shm
echo Starting udev
/sbin/udevstart
echo -n "/sbin/hotplug" > /proc/sys/kernel/hotplug
echo "Loading dm-mod.ko module"
insmod /lib/dm-mod.ko
echo "Loading jbd.ko module"
insmod /lib/jbd.ko
echo "Loading ext3.ko module"
insmod /lib/ext3.ko
echo "Loading dm-mirror.ko module"
insmod /lib/dm-mirror.ko
echo "Loading dm-zero.ko module"
insmod /lib/dm-zero.ko
echo "Loading dm-snapshot.ko module"
insmod /lib/dm-snapshot.ko
/sbin/udevstart
echo Making device-mapper control node
mkdmnod
echo Scanning logical volumes
lvm vgscan --ignorelockingfailure
echo Activating logical volumes
lvm vgchange -ay --ignorelockingfailure VolGroup00
echo Creating root device
mkrootdev /dev/root
echo Mounting root filesystem
mount -o defaults --ro -t ext3 /dev/root /sysroot
echo Switching to new root
switchroot --movedev /sysroot


Regards,
MR

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] LVM partition and lvm commands in initrd
  2006-09-23  8:02 [linux-lvm] LVM partition and lvm commands in initrd Mark Ryden
@ 2006-09-23  8:27 ` Aleksandr Koltsoff
  2006-09-23 12:35   ` Mark Ryden
  2006-09-23  8:56 ` Luca Berra
  1 sibling, 1 reply; 5+ messages in thread
From: Aleksandr Koltsoff @ 2006-09-23  8:27 UTC (permalink / raw)
  To: LVM general discussion and development

Hi

Mark Ryden wrote:
> Hello linux-lvm,
>  There is one point which I want to understand and I hope I can get
> help here.

initrds are created automatically for you upon kernel package
installation in most linux distributions (fedora included). this means
that the mkinitrd/mkinitramfs-script will sniff around your system and
decide which modules (dm, ext3, hba-drivers, etc) to include in the
initrd and also sometimes decide which scripts to call (vgscan and
friends) and whether to include lvm-related tools into the initrd.
Similar story for software raid.

This means that if you take the initrd and try to boot a system that
doesn't have LVM you're doing something wrong. initrds are not supposed
to be portable, however this will of course depend very much on the
distribution.

Hope this answers your question.

ak.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] LVM partition and lvm commands in initrd
  2006-09-23  8:02 [linux-lvm] LVM partition and lvm commands in initrd Mark Ryden
  2006-09-23  8:27 ` Aleksandr Koltsoff
@ 2006-09-23  8:56 ` Luca Berra
  1 sibling, 0 replies; 5+ messages in thread
From: Luca Berra @ 2006-09-23  8:56 UTC (permalink / raw)
  To: linux-lvm

On Sat, Sep 23, 2006 at 11:02:02AM +0300, Mark Ryden wrote:
>The point which I want to understand is this:
>Is existence of LVM partition is a MUST so that this script
>will run and not cause panic on boot ?
>Suppose I would NOT have an LVM partition.
>(change its type with fdisk for example).
Please try to explain exactly what you are trying to do.

LVM is much more than a partition type, actually changing the partition
type with fdisk will not affect lvm at all.

>Will the calls to "lvm vgscan" and
>  "lvm vgchange" and "mkdmnod" and insmoding the dm* modules will not
>cause panic ?

lvm commands won't cause panics, only being unable to mount your root
file system will.

if you want to get completely rid of lvm you will need to backup and
reinstall your system without lvm.

L.


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] LVM partition and lvm commands in initrd
  2006-09-23  8:27 ` Aleksandr Koltsoff
@ 2006-09-23 12:35   ` Mark Ryden
  2006-09-23 15:49     ` Aleksandr Koltsoff
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Ryden @ 2006-09-23 12:35 UTC (permalink / raw)
  To: LVM general discussion and development

Hello ,


>...that the mkinitrd/mkinitramfs-script will sniff around your system...
>to boot a system that
> doesn't have LVM

 Luca said in an answer to this message: "LVM is much more than a
partition type,"

It is clear to me that the mkinitrd is dependant upon what I install.
But it is not clear to me what in the installation of Fedora Core
characterizes the
system as having LVM (or not having LVM).

What is a system that does have an LVM and a system that does NOT
have LVM ?
Suppose somebody goes to  an unknown fedora machine and want to know if there
is LVM on that machine. How can he know it? is the existence of LVM
partition is
a precondition ? meaning, if he runs "fdisk -l |grep LVM" and doesn't
get anything than it is not LVM , and if there is an LVM partition
than it is LVM machine? or is it not enough to to this check and there
should be some another check ?

The thing is that I made 2 installations of Fedora Core 5; in the
first I chose to format a partition as LVM and in the second I did
not. Is this is what causes the initrd to have the lvm commands in the
first case and not to have them in the second place ?
because I don't remeber that elsewhere in the installation process
that I did select
anything
connected with LVM (there is ofcouse the manual layout in which I
chode /dev/VolumeGroup... in the first case).

regards,
MR

On 9/23/06, Aleksandr Koltsoff <czr@iki.fi> wrote:
> Hi
>
> Mark Ryden wrote:
> > Hello linux-lvm,
> >  There is one point which I want to understand and I hope I can get
> > help here.
>
> initrds are created automatically for you upon kernel package
> installation in most linux distributions (fedora included). this means
> that the mkinitrd/mkinitramfs-script will sniff around your system and
> decide which modules (dm, ext3, hba-drivers, etc) to include in the
> initrd and also sometimes decide which scripts to call (vgscan and
> friends) and whether to include lvm-related tools into the initrd.
> Similar story for software raid.
>
> This means that if you take the initrd and try to boot a system that
> doesn't have LVM you're doing something wrong. initrds are not supposed
> to be portable, however this will of course depend very much on the
> distribution.
>
> Hope this answers your question.
>
> ak.
>
> _______________________________________________
> linux-lvm mailing list
> linux-lvm@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-lvm] LVM partition and lvm commands in initrd
  2006-09-23 12:35   ` Mark Ryden
@ 2006-09-23 15:49     ` Aleksandr Koltsoff
  0 siblings, 0 replies; 5+ messages in thread
From: Aleksandr Koltsoff @ 2006-09-23 15:49 UTC (permalink / raw)
  To: LVM general discussion and development

Mark Ryden wrote:
> Hello ,
>> ...that the mkinitrd/mkinitramfs-script will sniff around your system...
>> to boot a system that
>> doesn't have LVM
> Luca said in an answer to this message: "LVM is much more than a
> partition type,"

Which is of course true. LVM per se doesn't even care about the
partition type as Luca noted. When vgscan runs it will look for LVM on
disk metadata structures on the block devices that are present on the
system (subject to some restrictions). It won't care what the partition
types are as it reads any block devices. So as long as the kernel
identifies the partition (partition table is valid and recognizable) it
will be ok.

> It is clear to me that the mkinitrd is dependant upon what I install.
> But it is not clear to me what in the installation of Fedora Core
> characterizes the
> system as having LVM (or not having LVM).

Reading the relevant mkinitrd/mkinitramfs would probably solve your
question definitively since this is often distribution specific. And
main point here is to understand that initrd/initramfs:es might be
system specific. No one stops you from implementing a generic initrd
that contains everything imaginable, although that would slow system
boot time.

> What is a system that does have an LVM and a system that does NOT
> have LVM ?
> Suppose somebody goes to  an unknown fedora machine and want to know if
> there
> is LVM on that machine. How can he know it? is the existence of LVM
> partition is
> a precondition ? meaning, if he runs "fdisk -l |grep LVM" and doesn't
> get anything than it is not LVM , and if there is an LVM partition
> than it is LVM machine? or is it not enough to to this check and there
> should be some another check ?

There are many ways to detect LVM. Note that using fdisk might not
actually show whether LVM is used or not since LVM might be on sw-raid
and in that case normal distributions set the partition types to sw-raid
autodetect.

Some other ways to see that LVM is used:

dmsetup ls / info (LVM is implemented on "top of" device mapper).
ls -la /dev/mapper/ but this might be misleading as someone might be
using device mapper for non-LVM things as well.

one way is to check /etc/lvm/backup/ directory as it should include the
backups of LVM metadata and other device mapper tools don't use /etc/lvm.

there might be others. I personally use df -T on unknown systems and
then vg/lvdisplay if the filesystem block devices are behind /dev/mapper.

> The thing is that I made 2 installations of Fedora Core 5; in the
> first I chose to format a partition as LVM and in the second I did
> not. Is this is what causes the initrd to have the lvm commands in the
> first case and not to have them in the second place ?
> because I don't remeber that elsewhere in the installation process
> that I did select
> anything
> connected with LVM (there is ofcouse the manual layout in which I
> chode /dev/VolumeGroup... in the first case).

This is a fedora question so maybe someone intimate with that
distribution can answer. I noted that on ubuntu(lts) inclusion of LVM
tools is triggered by existance of /sbin/vgchange and existance of
/lib/lvm-200 so in this case I'd assume that the tools are always
included even if the system isn't using LVM). YMMV.

ak.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-09-23 15:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-23  8:02 [linux-lvm] LVM partition and lvm commands in initrd Mark Ryden
2006-09-23  8:27 ` Aleksandr Koltsoff
2006-09-23 12:35   ` Mark Ryden
2006-09-23 15:49     ` Aleksandr Koltsoff
2006-09-23  8:56 ` Luca Berra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.