Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

98.12. lvm2-2.03.42

Logical volume management tools

Version 2.03.42, release 1
Shelf disk — Block devices: partitioning, RAID, LVM, block encryption, SMART, NVMe, recovery, image writing and async I/O
Phase 41_system (System), 393 of 1047 in build order
Licence GPL-2.0-only AND LGPL-2.1-only
Homepage https://sourceware.org/lvm2/
Build time 1.5 SBU
Installed size 7.2 MiB in 166 files
Recipe ports/core/disk/lvm2/kpkgbuild

About

LVM2 is the Linux logical volume manager: it pools disks and partitions (physical volumes) into volume groups and carves those into logical volumes that can be resized, snapshotted, mirrored, thin-provisioned or cached, all through the kernel’s device-mapper. The port builds both halves of the source tree: the lvm tool with its pvcreate, vgchange, lvcreate and other names, and libdevmapper with dmsetup, which other storage ports link: cryptsetup, parted, libblockdev and udisks2 among them. /etc/init.d/03_lvm.sh activates the volume groups at boot, and the initramfs activates the one a root on a logical volume needs before that.

Sources

Dependencies

Depends on: libaio, eudev, util-linux, readline, libnvme.

Required by (9): cryptsetup, gparted, kpmcore, libblockdev, libvirt, parted, thin-provisioning-tools, udisks2, veracrypt.

Patches

build.sh applies these; kpkg applies nothing by itself.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install lvm2'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/disk/lvm2.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/disk/lvm2
echo '352703ef5b72ebb22d4f250284a29b89fe64d4049c6bf64c693f9af486c8081e  lvm2-2.03.42.tgz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/lvm2
SRC=$SRC_ROOT/lvm2-2.03.42
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf lvm2-2.03.42.tgz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

patch -p1 -i $PORT_SRC/musl-stdio-freopen.patch

THIN_CONFIGURE_WARN=y CACHE_CONFIGURE_WARN=y \
CONFIG_SHELL=/bin/bash  \
./configure --prefix=/usr \
	--libdir=/usr/lib \
	--libexecdir=/usr/lib \
	--enable-cmdlib \
	--enable-pkgconfig \
	--enable-udev_sync \
	--enable-dmeventd \
	--enable-readline \
	--with-blkid \
	--enable-blkid_wiping \
	--with-libnvme \
	--enable-nvme-wwid \
	--with-thin-check=/usr/sbin/thin_check \
	--with-thin-dump=/usr/sbin/thin_dump \
	--with-thin-repair=/usr/sbin/thin_repair \
	--with-thin-restore=/usr/sbin/thin_restore \
	--with-cache-check=/usr/sbin/cache_check \
	--with-cache-dump=/usr/sbin/cache_dump \
	--with-cache-repair=/usr/sbin/cache_repair \
	--with-cache-restore=/usr/sbin/cache_restore \
	--enable-thin_check_needs_check \
	--enable-cache_check_needs_check \
	--without-systemd \
	--with-default-event-activation=0 \
	--disable-selinux
make 
make DESTDIR=$PKG install_lvm2 install_device-mapper
find "$PKG" -name 69-dm-lvm.rules -delete

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/lvm2, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf lvm2-2.03.42-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/lvm2, and runs the triggers its paths call for.

Contents

Installed programs: blkdeactivate, dmeventd, dmsetup, dmstats, dmvdostats, fsadm, lvchange, lvconvert, lvcreate, lvdisplay, lvextend, lvm, lvm_import_vdo, lvmconfig, lvmdevices, lvmdiskscan, lvmdump, lvmpersist, lvmsadc, lvmsar, lvreduce, lvremove, lvrename, lvresize, lvs, lvscan, pvchange, pvck, pvcreate, pvdisplay, pvmove, pvremove, pvresize, pvs, pvscan, vgcfgbackup, vgcfgrestore, vgchange, vgck, vgconvert, vgcreate, vgdisplay, vgexport, vgextend, vgimport, vgimportclone, vgimportdevices, vgmerge, vgmknodes, vgreduce, vgremove, vgrename, vgs, vgscan, vgsplit.

Installed libraries: libdevmapper-event-lvm2.so, libdevmapper-event-lvm2mirror.so, libdevmapper-event-lvm2raid.so, libdevmapper-event-lvm2snapshot.so, libdevmapper-event-lvm2thin.so, libdevmapper-event-lvm2vdo.so, libdevmapper-event.so, libdevmapper.so, liblvm2cmd.so.

Installed directories: /etc/lvm, /usr/lib/device-mapper, /usr/share/licenses/lvm2.

Short descriptions

blkdeactivate Utility to deactivate block devices
dmeventd Device-mapper event daemon
dmsetup Low level logical volume management
dmstats Device-mapper statistics management
dmvdostats Display VDO statistics for device-mapper devices
fsadm Utility to resize or check filesystem on a device
lvchange Change the attributes of logical volume(s)
lvconvert Change logical volume layout
lvcreate Create a logical volume
lvdisplay Display information about a logical volume
lvextend Add space to a logical volume
lvm LVM tools
lvm_import_vdo Utility to import VDO volumes into a new volume group
lvmconfig Display and manipulate configuration information
lvmdevices Manage the devices file
lvmdiskscan List devices that may be used as physical volumes
lvmdump Create lvm2 information dumps for diagnostic purposes
lvmpersist Manage persistent reservations on a group of block devices
lvmsadc LVM system activity data collector
lvmsar LVM system activity reporter
lvreduce Reduce the size of a logical volume
lvremove Remove logical volume(s) from the system
lvrename Rename a logical volume
lvresize Resize a logical volume
lvs Display information about logical volumes
lvscan List all logical volumes in all volume groups
pvchange Change attributes of physical volume(s)
pvck Check metadata on physical volumes
pvcreate Initialize physical volume(s) for use by LVM
pvdisplay Display various attributes of physical volume(s)
pvmove Move extents from one physical volume to another
pvremove Remove LVM label(s) from physical volume(s)
pvresize Resize physical volume(s)
pvs Display information about physical volumes
pvscan List all physical volumes
vgcfgbackup Backup volume group configuration(s)
vgcfgrestore Restore volume group configuration
vgchange Change volume group attributes
vgck Check the consistency of volume group(s)
vgconvert Removed: vgconvert has been removed along with the lvm1 format
vgcreate Create a volume group
vgdisplay Display volume group information
vgexport Unregister volume group(s) from the system
vgextend Add physical volumes to a volume group
vgimport Register exported volume group with system
vgimportclone Import a VG from cloned PVs
vgimportdevices Add devices for a VG to the devices file
vgmerge Merge volume groups
vgmknodes Create the special files for volume group devices in /dev
vgreduce Remove physical volume(s) from a volume group
vgremove Remove volume group(s)
vgrename Rename a volume group
vgs Display information about volume groups
vgscan Search for all volume groups
vgsplit Move physical volumes into a new or existing volume group
devmapper.pc device-mapper library
devmapper-event.pc device-mapper event library

Notes