LVM2-2.03.23

LVM2 の概要

LVM2 パッケージは論理パーティションを管理します。 複数の物理ディスク間やディスクパーティション間にわたってのファイルシステム構築を実現し、論理パーティションの動的な拡大縮小の機能なども提供します。

[注記]

注記

LFS や依存パッケージが本ブックに示す最新安定バージョンでなかった場合には、BLFS 開発版においては、パッケージのビルドや処理実行が適切に行われないことがあります。

パッケージ情報

  • ダウンロード (HTTP): https://sourceware.org/ftp/lvm2/LVM2.2.03.23.tgz

  • ダウンロード MD5 sum: 0535b5e638b6f0b48f7b259e0ec0ba65

  • ダウンロードサイズ: 2.7 MB

  • 必要ディスク容量: 39 MB (add 20 MB for tests; transient files can grow up to around 300 MB in the /tmp directory during tests)

  • 概算ビルド時間: 0.1 SBU (using parallelism=4; add 9 to 48 SBU for tests, depending on disk speed and whether ram block device is enabled in the kernel)

LVM2 Dependencies

Required

libaio-0.3.113

Optional

mdadm-4.2, Valgrind-3.22.0, Which-2.21, xfsprogs-6.5.0 (all four may be used, but are not required, for tests), reiserfsprogs, thin-provisioning-tools, and vdo

カーネルの設定

以下に示すカーネル設定のオプションを有効にして、カーネルを再コンパイルしてください。

[注記]

注記

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.

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]

LVM2 のインストール

以下のコマンドを実行して LVM2 をビルドします。

PATH+=:/usr/sbin                \
./configure --prefix=/usr       \
            --enable-cmdlib     \
            --enable-pkgconfig  \
            --enable-udev_sync  &&
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 instructions as the root user:

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

To test the results, issue, as the root user:

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 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 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).

[注記]

注記

The checks create device nodes in the /tmp directory. The tests will fail if /tmp is mounted with the nodev option.

root ユーザーになって以下を実行します。

make install
rm -fv /usr/lib/udev/rules.d/69-dm-lvm.rules

コマンド説明

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: このスイッチは共有コマンドライブラリをビルドすることを指示します。 デーモンをビルドする際にはこれが必要になります。

--enable-pkgconfig: このスイッチの指定により pkgconfig サポートファイルをインストールします。

--enable-udev_sync: このスイッチは Udev との同期処理を有効にします。

--enable-dmeventd: このスイッチは Device Mapper イベントデーモンをビルドすることを指示します。

rm .../69-dm-lvm.rules: Under certain circumstances, this udev rule calls systemd-run, which is not available on sysv. It performs actions that are done by another boot script anyway, so it is not needed.

パッケージ構成

インストールプログラム: blkdeactivate, dmeventd (任意ビルド), dmsetup, fsadm, lvm, lvmdump, lvm_import_vdo この他に lvm に対してのシンボリックリンクが数多くあり、所定の機能を提供します。
インストールライブラリ: libdevmapper.so and liblvm2cmd.so; optional: libdevmapper-event.so, libdevmapper-event-lvm2.so, libdevmapper-event-lvm2mirror.so, libdevmapper-event-lvm2raid.so, libdevmapper-event-lvm2snapshot.so, libdevmapper-event-lvm2thin.so, libdevmapper-event-lvm2vdo.so
Installed Directories: /etc/lvm and /usr/lib/device-mapper (任意ビルド)

概略説明

blkdeactivate

is a utility to deactivate block devices

dmeventd

(optional) is the Device Mapper event daemon

dmsetup

is a low level logical volume management tool

fsadm

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

lvm

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

lvmdump

is a tool used to dump various information concerning LVM2

vgimportclone

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

libdevmapper.so

contains the Device Mapper API functions