Enterprise Volume Management System

Home

Project Page

Mailing Lists

IRC Channel

Documentation

Screen Shots

Downloads

Related Projects

Hosted By:
SourceForge Logo

Mounting Your Root Filesystem Through EVMS

Now that volume discovery and activation are done in user-space, there is an issue with having your system's root filesystem on an EVMS volume. In order for the root filesystem's volume to be activated, the EVMS tools must run. But in order to get to the EVMS tools, the root filesystem must be mounted.

The solution to this dilemma is to use an initial ramdisk (initrd). This is a ram-based device that acts as a temporary root filesystem at boot time, and provides the ability to run programs and load modules that are necessary to activate the true root filesystem.

In order to simplify the process of setting up an initrd, a usable sample initrd is now provided on the EVMS web site, which you downloaded earlier and saved in the /boot directory. This compressed initrd image contains pre-compiled EVMS 2.5.5 tools, and a linuxrc script to run evms_activate to activate your volumes so the root filesystem can be mounted.

You can use this initrd image without modification if your kernel has the following features compiled in statically (not as modules):

  • Device-Mapper
  • MD (if you use Software-RAID in your volumes)
  • Drivers for your disk drives (IDE and/or SCSI)
  • RAM Disk and Initrd
  • Ext2 Filesystem
  • The type of filesystem used for your root filesystem.

You must also have an /initrd directory in your root filesystem. At bootup, once the EVMS volumes are activated, the root volume will be mounted within the initrd. Then the linuxrc script will "pivot" the root filesystem from the initrd to the real root filesystem and the initrd will end up mounted at /initrd. If you do not already have this directory, create it now:

mkdir /initrd

This initrd image will work without devfs. It will also work with devfs as long as you configure your kernel to automatically mount devfs at boot-time, and if you normally run devfsd.

Boot-Loader Setup

To get your kernel to load and run this initrd image and to mount your root filesystem using your EVMS volumes, you just have to make a small change to your boot-loader configuration file.

  • LILO Users

    Edit your /etc/lilo.conf file. If you haven't already, add an image section for the kernel you will be using with EVMS. The section should look something like this:

    image = /boot/vmlinuz-2.4.32
       label = 2.4.32
       read-only
       initrd = /boot/evms-2.5.5-initrd.gz
       append = "ramdisk=8192 root=/dev/evms/Root_Volume"
    

    The image and label lines specify the kernel image you want to boot, and what it should be called in the LILO menu. The initrd line specifies where to find the initrd image that you downloaded. The append line tells the kernel how big the initrd image is (in kilobytes, uncompressed), as well as where to find your root filesystem. You should obviously replace /dev/evms/Root_Volume with the name of the EVMS volume that contains your root filesystem.

    NOTE: You must specify the root volume in the "append=" line. Do not use a sepatate "root=" line! LILO will translate the specified device name into a device number, instead of passing the full device name on the kernel command line. Without the full device name, the initrd will not be able to mount the root filesystem.

    If you need to pass any special mount options to your root filesystem, or if your root filesystem is one that the kernel cannot auto-detect, you can also specify the rootflags= and rootfstype= options on the append line in your /etc/lilo.conf file. The initrd will use these extra options when initially mounting your root filesystem. See the Documentation/kernel-parameters.txt file in the kernel source tree for more details on these extra kernel parameters.

    Save your /etc/lilo.conf and run lilo.

  • Grub Users

    Edit your /boot/grub/menu.list file. If you haven't already, add a menu entry for the kernel you will be using with EVMS. The entry should look something like this:

    title 2.4.32
       kernel (hd0,0)/vmlinuz-2.4.32 root=/dev/evms/Root_Volume ramdisk=8192
       initrd (hd0,0)/evms-2.5.5-initrd.gz
    

    The title is the label you would like to use for that kernel in the Grub menu. The kernel line specifies where to find the kernel image, where to find the root filesystem, and the size of the initrd image (in kilobytes, uncompressed). You should obviously replace /dev/evms/Root_Volume with the name of the EVMS volume that contains your root filesystem. The initrd line specifies where to find the initrd image that you downloaded. See the Grub documentation for which (hdx,y) value to use (in this example, the /boot filesystem is on its own partition, which is the first partition on the first IDE disk).

    If you need to pass any special mount options to your root filesystem, or if your root filesystem is one that the kernel cannot auto-detect, you can also specify the rootflags= and rootfstype= options on the kernel line in your /boot/grub/menu.list file. The initrd will use these extra options when initially mounting your root filesystem. See the Documentation/kernel-parameters.txt file in the kernel source tree for more details on these extra kernel parameters.

    Save your /boot/grub/menu.list file.

fstab Setup

In addition to the boot-loader configuration, your /etc/fstab file must also be modified to indicate you want to mount your root filesystem using an EVMS volume. Edit your /etc/fstab file, and find the line that specifies your root filesystem. It will look something like this:

/dev/hda1     /     ext3     defaults     1  1

The first item in this line is the root device. Simply change this device name to the EVMS volume name. In this example, you just change /dev/hda1 to /dev/evms/hda1.

At this point, if your kernel meets the above requirements, you can reboot your system. After the kernel initializes itself, it will load the init-ramdisk, which will run evms_activate. When the init-ramdisk finishes, your root filesystem will be mounted using your EVMS volume.


Modifying the Init-Ramdisk Image

If your setup doesn't exactly match the above requirements, you might be able to make some simple modifications to the sample initrd image to make it work properly on your system. A couple of examples of why you might want to modify this initrd are:

  • You need to load kernel modules from the initrd.
  • You have a different devfs setup.
  • You have other utilities you need to run from your initrd.

This initrd is 16 MB in size, but only about 1/4 of that is currently used. This was done to provide you with enough extra space to add things like kernel modules or other utilities that you need to run. (If you find that 16 MB is not enough space, you might need to create a new initrd image from scratch.)

  1. Mount the initrd

    To modify the initrd, you first need to uncompress and mount the image. Use the following commands:

    cd /boot
    gunzip evms-2.5.5-initrd.gz
    cd /mnt
    mkdir initrd
    mount -o loop /boot/evms-2.5.5-initrd initrd/
    

    In the /mnt/initrd/ directory you will see the directory layout of the init-ramdisk. It looks very much like a stripped-down version of your root filesystem. This init-ramdisk uses Busybox, which acts as a replacement for many of the commonly used Linux utilities, but takes up a fraction of the space.

    Browse through the directory structure to get an idea of the programs and libraries that are currently available. Of particular interest is the linuxrc script at the top-level of the init-ramdisk. This is the script that is run when the initrd is loaded by the kernel. As you add extra libraries, utilities, and/or kernel modules, you will need to make modifications to the linuxrc script to make use of your additions.

  2. Loading Kernel Modules

    If you have compiled kernel modules that need to be loaded during the initrd, those kernel modules need to be copied to the initrd. You will find your kernel modules in the /lib/modules/x.y.z/ directory tree, where x.y.z is your kernel version. You will need to create a corresponding directory on the initrd and copy the necessary modules to this new directory. For example, if you compiled the MD/Software-RAID and Device-Mapper drivers as modules, and you're running a 2.4.32 kernel, enter the following commands.

    mkdir -p /mnt/initrd/lib/modules/2.4.32/
    cd /lib/modules/2.4.32/kernel/drivers/md/
    cp *.o /mnt/initrd/lib/modules/2.4.32/
    

    After copying the kernel modules, you must add the appropriate commands to the linuxrc script to load the modules from the initrd. Continuing the previous example, you would add the following commands to load the MD/Software-RAID modules.

    insmod md
    insmod linear
    insmod raid0
    insmod raid1
    insmod xor
    insmod raid5
    insmod multipath
    

  3. Changing the Devfs Setup

    There are a variety of ways to use devfs, and the sample initrd is setup to allow for the use of devfs. If devfs is mounted automatically by the kernel, the initrd will run devfsd (the devfs daemon). A devfsd.conf file is included on the initrd that tells devfsd to setup the compatibility symlinks in /dev. If you don't normally use this setup for devfsd, you should either modify /mnt/initrd/etc/devfsd.conf, or copy your own /etc/devfsd.conf to /mnt/initrd/etc/. For example, you might want to do this if you prefer the /dev/ide/host0/bus0/target0/lun0/disc style names instead of /dev/hda.

  4. Running Other Programs

    If you have other programs that need to be run from the init-ramdisk, you should copy those to the initrd. Most likely, they should be copied into the /mnt/initrd/bin or /mnt/initrd/sbin directories. You will also need to add an appropriate call to this program in the linuxrc script.

  5. Unmount the initrd

    When you are done with your modifications, you just need to unmount and compress the initrd image.

    cd /boot
    umount /mnt/initrd
    gzip evms-2.5.5-initrd
    

    If you are using LILO as your boot-loader, you also need to run the lilo command after compressing the initrd image.


Prev Table of Contents Next