This section of the document illustrates the steps necessary to complete installation: installing a suitable kernel, a RAM disk, configure the system so that it can boot and install all needed packages.
If any floppy has been mounted, unmount it then:
exit |
from the shell and return to main menu.
This is one of the most important steps of the whole process: to be able to boot with a root-on-LVM-on-RAID configuration a RAID and LVM enabled kernel is needed.
Before installing the kernel there is a question that needs an answer: to module or not to module?
More seriously: RAID and LVM support should be compiled statically into the kernel or loaded as an external module? Both solutions are feasible, but each one has some advantages and disadvantages that will be examined.
To boot a system with root-on-LVM-on-RAID (or just with root-on-LVM) a RAM disk is needed: this is necessary because root file system resides in a volume group, so to be able to access root file system LVM must first be started. Commands (and maybe modules) to accomplish this task are stored into a RAM disk, which is automatically loaded and used by the kernel.
When booting a system with root-on-LVM-on-RAID the following steps are performed:
LILO (or another boot loader with RAID support) is loaded.
Kernel image is loaded.
If RAID support is built in the kernel RAID arrays are auto-detected and started.
RAM disk image with LVM support is loaded and uncompressed.
RAM disk is mounted as root.
If RAID and LVM support is not built in the kernel these modules must be included in the RAM disk and loaded.
If RAID support has been loaded as a module RAID arrays must be started manually (RAM disk must be modified).
LVM is started.
Volume groups are detected and activated.
"Real" root file system over LVM is mounted read-only as new root file system.
RAM disk is unmounted.
LVM is started again (root has changed).
Root file system is checked for errors.
If no errors are found root file system is remounted read-write.
From this point on boot process continue as normal (modules are loaded, remaining file systems are mounted, …).
By choosing the first solution, modular support, there is one great advantage: the stock bf2.4 kernel shipped with Debian "Woody" 3.0 CD has RAID and LVM compiled as a module, so there is no need to compile a custom kernel. Moreover the kernel can be installed from main menu.
The main disadvantage of this solution is that with RAID support loaded as a module, RAID auto-detect does not work. To workaround this problem the RAM disk must be modified to make it start RAID arrays. The real problem is that array configuration has to be included into the RAM disk, and thus the RAM disk must be modified for each single system that is to be installed. This is not very good if several different systems are to be installed. Even worst in some cases if array configuration is changed, for example an array is added, the RAM disk must be updated.
The second solution, a custom kernel with built-in RAID and LVM support, has working RAID arrays auto-detect, and does not require manual RAM disk modifications. The drawback is that kernel compilation is required and that the kernel has to be installed manually.
To install the stock bf2.4 kernel choose "Install Kernel and Driver Modules" from the main install menu and then "Configure Device Driver Modules" to configure any required module.
It is not possible to install a custom kernel from the install menu: it's necessary to perform this step from command line. Probably to transfer the kernel image to the system, network access will be necessary along with some tools like ftp or wget.
For all these reasons installation of a custom kernel has to be performed later: necessary steps are reported in section Install custom kernel with statically compiled RAID and LVM.
From the main install menu choose "Configure the Hostname" and type a name for the system, then choose "Configure the Network" and configure network parameters as required (use DHCP or configure it manually).
From main install menu choose "Install the Base System" to install base Debian packages. Wait until all required packages are installed. Ignore the warning "No swap partition found".
![]() | Note | |
|---|---|---|
To perform the following steps another shell has to be opened. This time is better not to open it from the main menu but use tty2: usually pressing ALT-F2 brings up the second console. If the first console (ttyp0) is used, some command (ex. apt-setup) fail stating something like "Setting locale failed" (this with Debian "Woody" 3.0). It's still possible to use the first console by issuing:
before the offending command. |
Open a new shell (see previous note) and then chroot a shell into /target:
chroot /target /bin/sh |
Then remount proc:
mount -t proc proc /proc |
Some additional packages have to be installed: the best way to do this is by using apt-get.
Before using this utility APT must be configured. Type:
apt-setup |
and configure package sources (CDROM or ftp sites).
Since some required packages (ex. lvm10) are not present in the two firsts Debian CDROM it is better to configure at least one APT ftp source, to be able to install these packages through the network. This, of course, is possible only if network access is available during install.
If for some unfortunate reason the system cannot be made access the network during install (ex. some strange network card not supported by stock bf2.4 kernel is used, not even as a module, not even as an external custom module, not even by passing some weird startup parameter to the kernel while booting, …) some packages (ex. lvm10) will have to be installed manually using dpkg command.
This can be a little tricky: lvm10 depends on other packages an these must be installed in the correct order.
In section Install RAID and LVM packages the exact package list and order of dependencies is given along with the manual install procedure.
![]() | Note |
|---|---|
Usually debian install executes apt-setup after the first reboot. Executing it so early can lead to another problem: at this stage the cdrom is mounted over /instmnt, and the device used for the cdrom is not may not be /dev/cdrom but, for example, /dev/hdd If this is the case when specifying a cdrom as a package source probably /dev/cdrom will not work: use the actual device (it can be guessed using mount). |
Skip this step if stock kernel bf2.4 has been previously installed into the system.
To install a custom kernel of course this has first to be acquired or compiled. Below there are links to an already compiled kernel, steps for compilation are shown in next section.
From this link can be downloaded a Debian package (.deb) with 2.4.18 kernel that has RAID 1 and 5 along with LVM support statically compiled in, it has also devfsd support enabled: http://www.midhgard.it/files/lvm/kernel/kernel-image-2.4.18-lvm_1.0_i386.deb
The kernel has been compiled for i386 architecture. This kernel package has been compiled on a Debian system by using make-kpkg command.
This is the .config file used to compile it: http://www.midhgard.it/files/lvm/kernel/config-2.4.18-lvm
Here can be downloaded a tarball containing the kernel image, system map and modules. This can be used on distributions different from Debian: http://www.midhgard.it/files/lvm/kernel/kernel-image-2.4.18-lvm_1.0_i386.tgz
Once kernel package or binaries have been copied/compiled into the system the kernel can be installed.
If the kernel has been acquired as a Debian package:
Install the kernel:
dpkg -i kernel_image-2.4.18-lvm_1.0_i386.deb |
Ignore any warning about the need to reboot urgently. The install script will ask a few questions about lilo: do not have it create the simbolic link (it would create it in /), do not write now the configuration to disk and do not wipe out lilo configuration.
Create a simbolic link from the kernel image to /boot/vmlinuz
ln -s /boot/vmlinuz-2.4.18-lvm /boot/vmlinuz |
If the kernel has been acquired as a tarball:
Unpack the kernel:
tar -zxvf kernel_image-2.4.18-lvm_1.0_i386.tgz |
Move vmlinuz-2.4.18-lvm and config-2.4.18-lvm into /boot:
mv vmlinuz-2.4.18-lvm config-2.4.18-lvm /boot/ |
Move module files into /lib/modules/
mv 2.4.18-lvm /lib/modules/ |
Create symbolic links:
ln -s /boot/System.map-2.4.18-lvm /boot/System.map ln -s /boot/config-2.4.18-lvm /boot/config ln -s /boot/vmlinuz-2.4.18-lvm /boot/vmlinuz |
To compile a custom kernel it is necessary to download the source, unpack it, configure it or copy a configuration file and then run the compile. While it is possible to compile the kernel "on-the-fly" during installation, this requires installing some additional packages, at least on Debian. It is better to compile the kernel on an already installed system, then pack the binaries and transfer them to the system that is being installed.
In order to have a kernel able to boot a RAID or LVM system there are a few options that must be set, these are:
Multiple device support (CONFIG_MD=y)
RAID device support (CONFIG_BLK_DEV_MD=y)
RAID 0 support, if using RAID 0 arrays (CONFIG_MD_RAID0=y)
RAID 1 support, if using RAID 1 arrays (CONFIG_MD_RAID1=y)
RAID 5 support, if using RAID 5 arrays (CONFIG_MD_RAID5=y)
LVM support, if using LVM (CONFIG_BLK_DEV_LVM=y)
Moreover, since a RAM disk has to be loaded, following options must be set:
Loopback device support (CONFIG_BLK_DEV_LOOP=y)
RAM disk support (CONFIG_BLK_DEV_RAM=y)
Maximum RAM disk size, default is 4096 (4 MB), do not change this (CONFIG_BLK_DEV_RAM_SIZE=4096)
Initial RAM disk support (CONFIG_BLK_DEV_INITRD=y)
Optionally devfs support can be compiled into the kernel. devfs is, in kernel 2.4.18, an experimental feature: it is a virtual /dev file system (like /proc) that replaces classical /dev file system. Main advantages of devfs are that devices are dynamically registered as needed, and this happens just for devices that are effectively used by the system. For more information look at devfs documentation in the kernel source.
devfs support (CONFIG_DEVFS_FS=y)
Automatically mount devfs at boot (CONFIG_DEVFS_MOUNT=y)
If devfs support is enabled, it is recommended that devfsd is installed, look at section Optional: install devfsd
Kernel Sources can be downloaded from The Linux Kernel Archives http://www.kernel.org or installed with distribution specific means (deb packages for Debian, rpm packages for Red Hat).
For more information on kernel compilation look at Appendix D: kernel compilation tips.
Some additional packages are needed to support RAID, LVM and RAM disk use.
These are:
lvm10: current stable version 1.0.4-4
initrd-tools: current stable version 0.1.24
raidtools2: current stable version 0.90.20010914-15
mdadm: current stable version 0.7.2-2
Package lvm10 depends on lvm-common and file, lvm-common depends on binutils, initrd-tools depends on cramfsprogs. Dependencies are more complex, here have been indicated only missing packages after a Debian base install.
![]() | Note | |
|---|---|---|
If apt has been configured to use a cdrom as source for packages, manually mount the cdrom over /cdrom in the chrooted environment before using apt-get, because at this stage of install process auto-mount does not work. The device for the cdrom will probably not be /dev/cdrom, as explained in section Configure APT. Use:
to mount the cdrom (change the device if necessary). |
If APT has been correctly configured and network access is available (look at section Configure APT) to install these packages use:
apt-get install lvm10 initrd-tools raidtools2 mdadm |
The package mdadm has to be configured: answer "Yes" when asked if the RAID monitor daemon has to be started, then configure an e-mail address which has to be notified when a disk failure event happens.
If APT cannot be used manual package install is required. For each package file:
dpkg -i package_filename.deb |
The following packages must be installed:
lvm10
raidtools2
initrd-tools
mdadm
ash
binutils
cramfsprogs
file
lvm-common
zlib1g
If a custom kernel with devfs support enabled has been installed it is recommended to install devfsd. devfsd is a daemon that automatically handles the registration and removal of device entries into devfs.
To install devfsd use:
apt-get install devfsd |
![]() | Warning! |
|---|---|
Do not perform this step if the stock kernel bf2.4 has been installed since it has no devfs support. |
Since the current is chrooted, LVM subsystem has to be re-started in the new environment:
vgscan |
has to be used again. It will state again that it's creating /etc/lvmtab.
![]() | Note |
|---|---|
This step is necessary before lilo configuration can be written to disk. So must be executed before section Write lilo configuration to disk. It cannot be executed before because prior to installing package lvm10 the command vgscan is not available in the chrooted environment. |
As for kernel installation, RAM disk installation is one of the most important steps in successfully installing (and rebooting!) a root-on-LVM system.
In sections Boot process overview and RAID and LVM support loaded as a module vs statically linked an overview of problems related to RAM disk and kernel has already been presented. This section will show more in detail step necessary to install a suitable RAM disk. Here are shown also steps necessary to create the RAM disk.
![]() | Note |
|---|---|
RAM disk creation can be a complicate matter (at least the author of this document hasn't found any way to make it simpler ;). In case the option of downloading the RAM disk is chosen, skip those section of the document. |
Download this RAM disk or create one as explained in section RAM disk for bf2.4 kernel: requirements and creation, then copy it to /boot on the system that's being installed and create a symbolic link /boot/initrd to it.
ln -s /boot/initrd.gz /boot/initrd |
Download this RAM disk or create one as explained in section RAM disk for custom kernel: requirements and creation, then copy it to /boot on the system that's being installed and create a symbolic link /boot/initrd to it.
ln -s /boot/initrd.gz /boot/initrd |
The requirements for a RAM disk to be used with a kernel that has RAID and LVM support statically compiled will be presented first, since they are simpler than the ones for kernel with modular support.
With this kind of kernel RAID array autodetect and autostart at boot works. Moreover the RAM disk must not contain modules for RAID and LVM support (they already are in the kernel!).
The role of the RAM disk in this case is limited to start LVM subsystem (vgscan) and activate volume group(s) (vgchange).
Requirements are as follows:
RAM disk must contain commands vgscan and vgchange.
RAM disk must contain commands mount and umount.
Any library needed by previous commands, particularly liblvm1.0.so.1
A linuxrc file that issues commands necessary to activate LVM and volume group(s).
The linuxrc file must be like the one shown below, the same file can be downloaded here:
#!/bin/sh /bin/mount /proc /sbin/vgscan /sbin/vgchange -a y /bin/umount /proc |
The RAM disk can be created at hand (modify an existing one or create it with mkinitrd and then modify it) or it can be created automatically using lvmcreate_initrd: this command creates a RAM disk that mets above requirements and puts it into /boot.
It is suggested that RAM disk creation is performed prior to installing the wanna be RAID system (on another already installed system) or that an available RAM disk is used.
The RAM disk can be created during install process, but this can be a little tricky: lvmcreate_initrd tryies to put into the RAM disk modules from the directory /lib/modules/kernel_version, where kernel_version is the kernel used for boot: if the command is used during the installation, the same kernel used for boot (ex. bf2.4) must already have been installed on the system, even if later the system will be booted with another kernel (a custom one).
Ex. Debian install is booted using the 2.4.18-bf.24 kernel, if during install lvmcreate_initrd is called depmod will state that it cannot find modules.dep. To be able to create the RAM disk with this command the kernel bf2.4 must first be installed.
To modify an existing RAM disk or to examine an existing one:
If the RAM disk is compressed, uncompress it with:
gzip -cd /boot/initrd.gz > /boot/initrd_unc |
This uncompress the RAM disk in a copy: using gzip -d the compressed file will be removed. It will be necessary to generate it again with a gzip command. If these steps are performed on an already installed system remember to run lilo after.
Mount the RAM disk with:
mount -o loop /boot/initrd_unc /initrd |
Examine or modify the RAM disk in /initrd
Unmount the RAM disk with:
umount /initrd |
If necessary compress again the RAM disk:
gzip /boot/initrd_unc |
Read previous section for RAM disk requirements for static RAID support: in this section are illustrated only differences with that case. The same for commands necessary to RAM disk creation.
Since the kernel has no RAID and LVM support the modules for this must be included in the RAM disk:
md.o
raid1.o
lvm-mod.o
With RAID and LVM support compiled as a module, RAID autodetect will not work at boot. This requires that the RAM disk contains not only commands for starting LVM but also for starting RAID arrays (mdadm or raidstart).
Finally linuxrc file must include commands to load the modules and for starting RAID arrays. Below is shown a modified script, the same file can be downloaded here:
#!/bin/sh /sbin/modprobe md /sbin/modprobe raid1 /sbin/modprobe lvm-mod /sbin/mdadm -A -R /dev/md1 /dev/hda1 /dev/hdb1 /sbin/mdadm -A -R /dev/md2 /dev/hda2 /dev/hdb2 /bin/mount /proc /sbin/vgscan /sbin/vgchange -a y /bin/umount /proc |
As it can be easily noticed the script is dependent from disks and arrays configuration, so it must be modified to be adapted for each system: a mdadm command must be added for each RAID array.
To modify the RAM disk:
If the RAM disk is compressed, uncompress it.
Mount the RAM disk over /initrd
Add required modules to the RAM disk:
cp /lib/modules/2.4.18-bf2.4/kernel/drivers/md/md.o /initrd/lib/modules/2.4.18-bf2.4/kernel/drivers/md/ cp /lib/modules/2.4.18-bf2.4/kernel/drivers/md/raid1.o /initrd/lib/modules/2.4.18-bf2.4/kernel/drivers/md/ cp /lib/modules/2.4.18-bf2.4/kernel/drivers/md/lvm-mod.o /initrd/lib/modules/2.4.18-bf2.4/kernel/drivers/md/ |
Modify or copy linuxrc as shown above to include calls to mdadm.
Add mdadm to the RAM disk:
cp /sbin/mdadm /initrd/sbin/mdadm |
Unmount the RAM disk with.
If necessary compress again the RAM disk.
Some configuration files have to be copied into /etc (the "real" /etc, not the one in the RAM disk.
The file /etc/raidtab is needed for raid arrays management, create or copy it, look at section Create RAID arrays.
![]() | Note | |
|---|---|---|
In the chrooted shell the RAM disk is not accessible. To copy the file raidtab from the RAM disk use a non-chrooted shell:
To do this it is possible to exit from the chrooted shell and the reopen it. Otherwise remount the floppy with all config files in the chrooted shell and copy raidtab from floppy. |
File Systems Table: debian install does not detect file systems over lvm, so /etc/fstab created by install process will be empty; the file must be created by hand or copied.
Here can be downloaded an example /etc/fstab file, the same file is shown below. Modify it to reflect current configuration: boot raid device, logical volumes name or number.
# /etc/fstab: static file system information. # # <file system> <mount point> <type> <options> <dump> <pass> /dev/vg00/root / ext3 errors=remount-ro 0 1 /dev/vg00/swap none swap sw 0 0 proc /proc proc defaults 0 0 /dev/fd0 /floppy auto user,noauto 0 0 /dev/cdrom /cdrom iso9660 ro,user,noauto 0 0 /dev/md1 /boot ext2 defaults 0 2 /dev/vg00/home /home ext3 defaults 0 2 /dev/vg00/opt /opt ext3 defaults 0 2 /dev/vg00/tmp /tmp ext3 defaults 0 2 /dev/vg00/usr /usr ext3 defaults 0 2 /dev/vg00/var /var ext3 defaults 0 2 |
To make the system bootable lilo has to be configured.
Since version 22.0 lilo raid support has been made more powerful.
Taken from lilo changelog:
Changes from version 21.7.5 to 22.0 (29-Aug-2001) John Coffman [released 9/27]
Boot Installer
--------------
- RAID installations now create a single map file, install the
boot record on the RAID partition, install auxiliary boot
records only on MBRs if needed, except BIOS device 0x80. Back-
ward compatibility is possible with new config-file and command
line options (raid-extra-boot= or '-x' switch). Even with
stored boot command lines ('-R', lock, fallback), RAID set
coherency can be maintained. |
To have lilo boot from a RAID system use:
boot=/dev/md1 |
Change /dev/md1 if the boot device is different.
To use a root-on-LVM file system include the line:
root=/dev/vg00/root |
Change /dev/vg00/root if the volume group name or logical volume name are different.
Now disks whose MBR is to be written by lilo have to be indicated with option raid-extra-boot; from lilo.conf man page:
raid-extra-boot=<option> This option only has meaning for RAID1 installations. The <option> may be specified as none, auto, mbr-only, or a comma-separated list of devices; e.g., "/dev/hda,/dev/hdc6". Starting with LILO version 22.0, the boot record is normally written to the first sector of the RAID1 device. Use of an explicit list of devices, forces writing of auxiliary boot records only on those devices enumerated, in addition to the boot record on the RAID1 device. Since the version 22 RAID1 codes will never automatically write a boot record on the MBR of device 0x80, if such a boot record is desired, this is the way to have it written. |
So add this line to lilo.conf:
raid-extra-boot="/dev/hda, /dev/hdb" |
Change the disks to reflect system configuration.
Have the kernel mount root read-only by adding this option:
read-only |
Finally specify an image to be loaded at boot with related RAM disk.
image=/boot/vmlinuz
label=Linux
initrd=/boot/initrd |
With non standard disks setup options disk and bios it could be necessary to specify correspondence between disks and BIOS numbers. Look at lilo.conf man page for more details.
Below is shown an example /etc/lilo.conf, the same file can be downloaded here.
boot=/dev/md1
root=/dev/vg00/root
raid-extra-boot="/dev/hda, /dev/hdb"
read-only
image=/boot/vmlinuz
label=Linux
initrd=/boot/initrd |
Change the devices, kernel image name and RAM disk name as required or create symbolic links /boot/vmlinuz and /boot/initrd to regular files.
File /etc/modules contains modules to be loaded at startup. If the stock kernel is being used and modules configuration has been performed from the main menu (look at section Install stock bf2.4 Debian kernel with modular RAID and LVM support) this file should be already ok. Just check it with:
cat /etc/modules |
If a custom kernel has been installed manual module configuration will be necessary.
If any required module or parameter is missing add it. An example of /etc/modules is shown below:
# /etc/modules: kernel modules to load at boot time. # # This file should contain the names of kernel modules that are # to be loaded at boot time, one per line. Comments begin with # a "#", and everything on the line after them are ignored. usb-uhci input usbkbd keybdev |
This file can be downloaded here.
Last but not least, lilo configuration has to be written to disk.
![]() | Warning! |
|---|---|
Always remember to do this after any change to /etc/lilo.conf, kernel image file or RAM disk image. It is very easy to make the system unbootable by forgetting this step. |
To write configuration to disk use:
lilo -v |
The -v option is used to have lilo give some more feedback on what is doing An output similar to the following should result:
LILO version 22.2, Copyright (C) 1992-1998 Werner Almesberger Development beyond version 21 Copyright (C) 1999-2001 John Coffman Released 05-Feb-2002 and compiled at 20:57:26 on Apr 13 2002. MAX_IMAGES = 27 Warning: LBA32 addressing assumed Warning: using BIOS device code 0x80 for RAID boot blocks Reading boot sector from /dev/md1 Merging with /boot/boot.b Boot image: /boot/vmlinuz -> /boot/vmlinuz-2.4.18-bf2.4 Mapping RAM disk /boot/initrd -> /boot/initrd-lvm-2.4.18-bf2.4.gz Added Linux * Backup copy of boot sector in /boot/boot.0901 Writing boot sector. The boot record of /dev/md1 has been updated. Reading boot sector from /dev/hde Backup copy of boot sector in /boot/boot.2100 Writing boot sector. The boot record of /dev/hde has been updated. Reading boot sector from /dev/hdg Backup copy of boot sector in /boot/boot.2200 Writing boot sector. The boot record of /dev/hdg has been updated. |
If a cdrom or a floppy had been manually mounted, unmount them (verify with mount command). Unmount also the remounted /proc.
umount /cdrom umount /floppy umount /proc |
There are no other steps that have to be performed from the chrooted environment:
exit |
to the original shell.
![]() | Note |
|---|---|
Before exiting and rebooting it could be worth to take a look at /proc/mdstat: if the newly created arrays are still resyncing, rebooting would have the resync process restart. While this is not a problem it could be a waste of time: look at the ETA and decide if it's best to wait or to reboot. |
Again:
exit |
to the main install menu.
From the menu choose "Reboot the system".
As soon as the machine reboot remove Debian CDROM and any floppy, so that the system can boot from hard disk.
Look carefully at boot messages: if everything is ok the system will complete boot sequence by loading the RAM disk, mount root file system and then all other file systems. Look at section Boot process overview for more informations. Look at Appendix E: boot messages for some examples of successful boot messages.
If some nasty message is printed (something like "Kernel Panic") and boot process stops, don't despair: if the system is unable to load the kernel, the RAM disk or to start LVM and mount root file system for any reason, it is always possible to boot again from installation media and use LVM and RAID extdisk as a rescue disk, activating manually volume group(s) and mounting manually file systems. If this is the case, write down any error message, then boot from install media and try to correct the problem.
Look at Appendix C: troubleshooting tips for detailed troubleshooting tips.
When the system reboots Debian install process will complete as usual. The command:
base-config |
will be run automatically. This tool is Debian specific and will configure time-zone, password management, normal user accounts, APT, run tasksel and dselect to install additional packages.