10.2. Upgrading to LVM 1.0.8 with an LVM root partition and initrd

This is relatively straightforward if you follow the steps carefully. It is recommended you have a good backup and a suitable rescue disk handy just in case.

The "normal" way of running an LVM root file system is to have a single non-LVM partition called /boot which contains the kernel and initial RAM disk needed to start the system. The system I upgraded was as follows:

 # df

Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/rootvg/root        253871     93384    147380  39% /
/dev/hda1                17534     12944      3685  78% /boot
/dev/rootvg/home       4128448      4568   3914168   0% /home
/dev/rootvg/usr        1032088    332716    646944  34% /usr
/dev/rootvg/var         253871     31760    209004  13% /var

            
/boot contains the old kernel and an initial RAM disk as well as the LILO boot files and the following entry in /etc/lilo.conf

 # ls /boot

System.map                 lost+found              vmlinux-2.2.16lvm
map                        module-info	           boot.0300  
boot.b                     os2_d.b                 chain.b
initrd.gz                  

 # tail /etc/lilo.conf

image=/boot/vmlinux-2.2.16lvm
        label=lvm08
        read-only
        root=/dev/rootvg/root
        initrd=/boot/initrd.gz
        append="ramdisk_size=8192"

            

  1. Build LVM kernel and modules

    Follow the steps outlined in Chapter 5 - Section 6.2 for instructions on how to get and build the necessary kernel components of LVM.

  2. Build the LVM user tools

    Follow the steps in Section 6.2 to build and install the user tools for LVM.

    Install the new tools. Once you have done this you cannot do any LVM manipulation as they are not compatible with the kernel you are currently running.

  3. Rename the existing initrd.gz

    This is so it doesn't get overwritten by the new one
    
# mv /boot/initrd.gz /boot/initrd08.gz
                         

  4. Edit /etc/lilo.conf

    Make the existing boot entry point to the renamed file. You will need to reboot using this if something goes wrong in the next reboot. The changed entry will look something like this:
    
image=/boot/vmlinux-2.2.16lvm
            label=lvm08
            read-only
            root=/dev/rootvg/root
            initrd=/boot/initrd08.gz
            append="ramdisk_size=8192"
                         

  5. Run lvmcreate_initrd to create a new initial RAM disk
    
# lvmcreate_initrd 2.4.9
                         
    Don't forget the put the new kernel version in there so that it picks up the correct modules.

  6. Add a new entry into /etc/lilo.conf

    This new entry is to boot the new kernel with its new initrd.
    
image=/boot/vmlinux-2.4.9lvm
            label=lvm10
            read-only
            root=/dev/rootvg/root
            initrd=/boot/initrd.gz
            append="ramdisk_size=8192"
                         

  7. Re-run lilo

    This will install the new boot block
    
# /sbin/lilo
                         

  8. Reboot

    When you get the LILO prompt select the new entry name (in this example lvm10) and your system should boot into Linux using the new LVM version.

    If the new kernel does not boot, then simply boot the old one and try to fix the problem. It may be that the new kernel does not have all the correct device drivers built into it, or that they are not available in the initrd. Remember that all device drivers (apart from LVM) needed to access the root device should be compiled into the kernel and not as modules.

    If you need to do any LVM manipulation when booted back into the old version, then simply recompile the old tools and install them with
    
# make install
                         
    If you do this, don't forget to install the new tools when you reboot into the new LVM version.

When you are happy with the new system remember to change the ``default='' entry in your lilo.conf file so that it is the default kernel.