Introduction to LVM2

The LVM2 package is a set of tools that manage logical partitions. It allows spanning of file systems across multiple physical disks and disk partitions and provides for dynamic growing or shrinking of logical partitions, mirroring and low storage footprint snapshots.

This package is known to build and work properly using an LFS-7.8 platform.

Package Information

  • Download (FTP):

  • Download MD5 sum: d49eb6abaa4e35329ae256d53a7d3726

  • Download size: 1.8 MB

  • Estimated disk space required: 31 MB (during tests, transcient files can grow up to around 500 MB)

  • Estimated build time: 0.3 SBU (around 28 SBU with tests, see below)

LVM2 Dependencies


mdadm-3.3.4, reiserfsprogs-3.6.24, Valgrind-3.11.0, Which-2.21, xfsprogs-4.3.0 (all five may be used, but are not required, for tests), and thin-provisioning-tools

User Notes:



Kernel versions in the 4.1 and 4.2 series have a broken RAID implementation. If you want to use RAID type LV's, you should install a kernel with version above 4.2.4. Note that several tests use RAID logical volumes, and can generate a “kernel oops” with faulty kernel version, which usually renders the system unusable.

Kernel Configuration

Enable the following options in the kernel configuration and recompile the kernel:



There are several other Device Mapper options in the kernel beyond those listed below. In order to get reasonable results if running the regression tests, all must be enabled either internally or as a module.

Device Drivers --->
  [*] Multiple devices driver support (RAID and LVM) ---> [CONFIG_MD]
    <*/M>   Device mapper support                         [CONFIG_BLK_DEV_DM]
    <*/M/ >   Crypt target support                        [CONFIG_DM_CRYPT]
    <*/M/ >   Snapshot target                             [CONFIG_DM_SNAPSHOT]
    <*/M/ >   Thin provisioning target                    [CONFIG_DM_THIN_PROVISIONING]
    <*/M/ >   Mirror target                               [CONFIG_DM_MIRROR]

Installation of LVM2

Install LVM2 by running the following commands:

SAVEPATH=$PATH                  &&
pathappend /sbin:/usr/sbin      &&
./configure --prefix=/usr       \
            --exec-prefix=      \
            --enable-applib     \
            --enable-cmdlib     \
            --enable-pkgconfig  \
            --enable-udev_sync  &&
make                            &&
PATH=$SAVEPATH                  &&

The tests use udev for logical volume synchronization, so that the LVM udev rules and some utilities need to be installed before running the tests. If you are installing LVM2 for the first time, and do not want to install the full package before running the tests, the minimal set of utilities can be installed by running the following instructions as the root user:

make -C tools install_dmsetup_dynamic &&
make -C udev  install                 &&
make -C libdm install

To test the results, issue: make check_local as the root user. Other targets are available and can be listed with make -C test help. The test timings are very dependent on the speed of the disk(s), and on the number of enabled kernel options.

Those tests do not implement the “expected fail” possibility, and a small number of test failures is expected by upstream. More failures may happen because some kernel options are missing. For example, the lack of the dm-delay device mapper target may explain up to 10 failures or so. Some tests are flagged “warned” if thin-provisioning-tools are not installed. A workaround is to add the following flags to configure:

     --with-thin-check=    \
     --with-thin-dump=     \
     --with-thin-repair=   \
     --with-thin-restore=  \
     --with-cache-check=   \
     --with-cache-dump=    \
     --with-cache-repair=  \
     --with-cache-restore= \

Some tests may hang with kernel versions in the 4.1 and 4.2 series (see above). They can be removed if necessary, for example: rm test/shell/ The tests generate a lot of kernel messages, which may clutter your terminal. You can disable them by issuing dmesg -D before running the tests (do not forget to issue dmesg -E when tests are done).

Now, as the root user:

make install

Command Explanations

pathappend /sbin:/usr/sbin: The path must contain /sbin and /usr/sbin for proper system tool detection by the configure script. These instructions ensure that it is properly set even if you build as an user. Note that you need to provide equivalent commands if you have not set up your startup files as in The Bash Shell Startup Files.

--enable-applib: This switch enables building of the shared application library.

--enable-cmdlib: This switch enables building of the shared command library. It is required when building the event daemon.

--enable-pkgconfig: This switch enables installation of pkg-config support files.

--enable-udev_sync: This switch enables synchronisation with Udev processing.

--enable-dmeventd: This switch enables building of the Device Mapper event daemon.

--enable-lvmetad: This switch enables building of the LVM metadata daemon, which avoids scanning all the filesystems when an lvm command is run.


Installed Programs: blkdeactivate, dmeventd (optional), dmsetup, fsadm, lvm, lvmconf, lvmdump, lvmetad (optional), and vgimportclone. There are also numerous symbolic links to lvm that implement specific functionalities
Installed Libraries:, and; optional:,,,,, and
Installed Directories: /etc/lvm and /lib/device-mapper (optional)

Short Descriptions


utility to deactivate block device.


(optional) is the Device Mapper event daemon.


is a low level logical volume management tool.


is a utility used to resize or check filesystem on a device.


provides the command-line tools for LVM2. Commands are implemented via sympolic links to this program to manage physical devices (pv*), volume groups (vg*) and logical volumes (lv*).


is a script that modifies the locking configuration in the LVM2 configuration file.


is a tool used to dump various information concerning LVM2.


(optional) is the LVM metadata daemon.


is used to import a duplicated VG (e.g. hardware snapshot).

contains the Device Mapper API functions.

Last updated on 2015-11-11 05:09:05 -0600