CLASS="sect1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" >

6.2. Build the LVM 1 kernel module

To use LVM 1 you will have to build the LVM 1 kernel module (recommended), or if you prefer rebuild the kernel with the LVM 1 code statically linked into it.

Your Linux system is probably based on one of the popular distributions (eg., Red Hat, SuSE, Debian) in which case it is possible that you already have the LVM 1 module. Check the version of the tools you have on your system. You can do this by running any of the LVM command line tools with the '-h' flag. Use pvscan -h if you don't know any of the commands. If the version number listed at the top of the help listing is LVM 1.0.8, use your current setup and avoid the rest of this section.

6.2.1. Building a patch for your kernel

In order to patch the linux kernel to support LVM 1.0.8, you must do the following:

  1. Unpack LVM 1.0.8

    
 # tar zxf lvm_1.0.8.tar.gz 
                      
  2. Enter the root directory of that version.

    
 # cd LVM/1.0.8 
                      
  3. Run configure

    
 # ./configure 
                      

    You will need to pass the option --with-kernel_dir to configure if your linux kernel source is not in /usr/src/linux. (Run ./configure --help to see all the options available)

  4. Enter the PATCHES directory

    
 # cd PATCHES 
                      
  5. Run 'make'

    
# make 
                      

    You should now have a patch called lvm-1.0.8-$KERNELVERSION.patch in the patches directory. This is the LVM kernel patch referenced in later sections of the howto.

  6. Patch the kernel

    
 # cd /usr/src/linux ; patch -pX < /directory/lvm-1.0.8-$KERNELVERSION.patch 
                      

6.2.2. Building the LVM module for Linux 2.2.17+

The 2.2 series kernel needs to be patched before you can start building, look elsewhere for instructions on how to patch your kernel.

Patches:

  1. rawio patch

    Stephen Tweedie's raw_io patch which can be found at http://www.kernel.org/pub/linux/kernel/people/sct/raw-io

  2. lvm patch

    The relevant LVM 1 patch which should be built out of the PATCHES sub-directory of the LVM distribution. More information can be found in Section 6.2.1, Building a patch for your kernel.

Once the patches have been correctly applied, you need to make sure that the module is actually built, LVM 1 lives under the block devices section of the kernel config, you should probably request that the LVM /proc information is compiled as well.

Build the kernel modules as usual.

6.2.3. Building the LVM modules for Linux 2.4

The 2.4 kernel comes with LVM 1 already included although you should check at the Sistina web site for updates, (eg. v2.4.9 kernels and earlier must have the latest LVM 1 patch applied ). When configuring your kernel look for LVM 1 under Multi-device support (RAID and LVM). LVM 1 can be compiled into the kernel or as a module. Build your kernel and modules and install then in the usual way. If you chose to build LVM as a module it will be called lvm-mod.o

If you want to use snapshots with ReiserFS, make sure you apply the linux-2.4.x-VFS-lock patch (there are copies of this in the LVM/1.0.8/PATCHES directory.)

6.2.4. Checking the proc file system

If your kernel was compiled with the /proc file system (most are) then you can verify that LVM is present by looking for a /proc/lvm directory. If this doesn't exist then you may have to load the module with the command


 # modprobe lvm-mod 
         

If /proc/lvm still does not exist then check your kernel configuration carefully.

When LVM is active you will see entries in /proc/lvm for all your physical volumes, volume groups and logical volumes. In addition there is a "file" called /proc/lvm/global which gives a summary of the LVM status and also shows just which version of the LVM kernel you are using.