[linux-lvm] LVM partition and lvm commands in initrd

Mark Ryden markryde at gmail.com
Sat Sep 23 08:02:02 UTC 2006


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




More information about the linux-lvm mailing list