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.
Package Information
Download (HTTP): https://sourceware.org/ftp/lvm2/LVM2.2.03.36.tgz
Download SHA256 Sum: 44db12df4b990ed2c910176279f70b257f79ee6fc7684c577afbf59c13cd2cca
Download MD5 sum: 62a7c701fe07a5c30ff9fcb624cd3437
Download size: 2,949 KB
Estimated disk space required: 39 MB (add up to 300 MB for transient files for tests in the /tmp directory)
Estimated build time: 0.4 SBU (add 9 to 48 SBU for tests, depending on disk speed and options enabled in the kernel)
LVM2 Dependencies
Required
libaio-0.3.113
Optional for tests
'btrfs-progs',
dosfstools-4.2,
'jfsutils', 'mdadm', 'parted', 'valgrind',
Which-2.23,
'xfsprogs',
reiserfsprogs,
thin-provisioning-tools, and
vdo
Kernel Configuration
Enable the following options in the kernel configuration
and recompile the kernel:
![[Note]](../images/note.png)
Note
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.
The tests will all time out if Magic SysRq key is not enabled.
In addition most of the optional packages for tests require kernel options
that are needed. If the optional packages or their kernel options are not
installed the tests will be flagged as either failed or skipped in an
inconsistent way.
Device Drivers --->
[*] Block devices ---> [BLK_DEV]
<*/M> RAM block device support [BLK_DEV_RAM]
[*] Multiple devices driver support (RAID and LVM) ---> [MD]
<*/M> Device mapper support [BLK_DEV_DM]
<*/M> Crypt target support [DM_CRYPT]
<*/M> Snapshot target [DM_SNAPSHOT]
<*/M> Thin provisioning target [DM_THIN_PROVISIONING]
<*/M> Cache target (EXPERIMENTAL) [DM_CACHE]
<*/M> Mirror target [DM_MIRROR]
<*/M> Zero target [DM_ZERO]
<*/M> I/O delaying target [DM_DELAY]
Kernel hacking --->
Generic Kernel Debugging Instruments --->
[*] Magic SysRq key [MAGIC_SYSRQ]Installation of LVM2
Configure LVM2 by running the following commands:
PATH+=:/usr/sbin \
./configure --prefix=/usr \
--enable-cmdlib \
--enable-pkgconfig \
--enable-udev_sync
Build LVM2 by running the following commands:
make
The tests use udev for logical volume
synchronization, so 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 commands:
make -C tools install_tools_dynamic
make -C udev install
make -C libdm install
To test the results, issue:
LC_ALL=en_US.UTF-8 make check_local
Some tests may hang. In this case they can be skipped by adding
S=<testname> to the make
command.
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.
The tests do not implement the “expected fail” possibility
and some test failures are expected by upstream.
Most tests will fail if the kernel does not have all the device
drivers listed above.
More failures may happen because some kernel options are missing.
For example, the lack of the dm-delay device
mapper target explains some failures.
Some tests may fail if there is insufficient free space available
in the partition with the /tmp directory. At least one test fails if 16 TB
is not available.
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. They can be removed if necessary, for example:
rm test/shell/lvconvert-raid-reshape.sh. 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).
![[Note]](../images/note.png)
Note
The checks create device nodes in the /tmp directory. The
tests will fail if /tmp is mounted with the nodev option.
Now, Istall LVM2 by running the following commands:
make install
make install_systemd_units
Command Explanations
PATH+=:/usr/sbin: The path
must contain
/usr/sbin for proper system tool
detection by the configure script. This instruction
ensures that PATH is properly set even if you build as an unprivileged user.
--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.
make install_systemd_units: This is needed to install
a unit that activates logical volumes at boot. It is not installed
by default.