Re: why does one need an initrd if using LVM?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 3 May 2003, Robert P. J. Day wrote:

>   so why is initrd.img necessary for LVs even when it has
> no modules?

The initrd image is needed to run a few initial commands within the initrd
image (filesystem). The system loads the "linuxrc" file from the initrd
image. This file is a script which scans the disks for volume groups,
etc. and mounts the root filesystem. For example, on my system linuxrc
runs at the end the following command:
mount -o defaults --ro -t ext3 /dev/Volume00/LogVol01 /sysroot

You can find the script "linuxrc" in the root directory of the initrd
image. You will also see that the linuxrc script uses the script
interpreter nash(8). This is a very small interpreter which has some
important built in commands like mount, umount, etc. See man nash(8).
You can find the nash interpreter in the bin directory of the initrd
image.

So basically, you need the initrd image for finding and mounting the root
fileystem. Here is a printout of my linuxrc script:

#!/bin/nash
echo "Loading lvm-mod module"
insmod /lib/lvm-mod.o
echo "Loading jbd module"
insmod /lib/jbd.o
echo "Loading ext3 module"
insmod /lib/ext3.o
echo Mounting /proc filesystem
mount -t proc /proc /proc
echo Creating block devices
mkdevices /dev
echo Scanning logical volumes
vgscan
echo Activating logical volumes
vgchange -ay
echo 0x0100 > /proc/sys/kernel/real-root-dev
echo Mounting root filesystem
mount -o defaults --ro -t ext3 /dev/Volume00/LogVol01 /sysroot
pivot_root /sysroot /sysroot/initrd
umount /initrd/proc

Werner






[Index of Archives]     [Fedora Users]     [Centos Users]     [Kernel Development]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat Phoebe Beta]     [Yosemite Forum]     [Fedora Discussion]     [Gimp]     [Stuff]     [Yosemite News]

  Powered by Linux