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
lvm2-2.03.42.tgz(3.0 MiB)
sha256352703ef5b72ebb22d4f250284a29b89fe64d4049c6bf64c693f9af486c8081e
upstream: https://sourceware.org/pub/lvm2/LVM2.2.03.42.tgz
archive copy: sources-1/disk--lvm2-2.03.42.tgz
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.
musl-stdio-freopen.patch— musl declaresstdin,stdoutandstderrasFILE *const, so a program cannot assign a new stream to them. Intools/lvmcmdline.c, where LVM opens/dev/nullon whichever of the three descriptors is closed, the patch replaces eachstdin = fopen(…)withfreopen(…, stdin). Inlib/commands/toolcontext.cit turns off, everywhere except glibc, the block that changes the buffering of the standard streams by reopening them, which stores the new stream through those same pointers and faults.
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:
THIN_CONFIGURE_WARN=y,CACHE_CONFIGURE_WARN=y— Set in configure’s environment, these mark the thin and cache tools as already warned about, which makes configure skip itsthin_check -Vandcache_check -Vprobes. The tools come from thin-provisioning-tools, which links this port’slibdevmapperand is therefore built after it, so the probes would find nothing and turn--needs-checkoff. configure’s closing warning that the tools are missing then describes the build machine, not the system the package goes on.CONFIG_SHELL=/bin/bash— The shell autoconf’s configure runs its tests under and writes into the scripts it generates, such asconfig.status.--libexecdir=/usr/lib— lvm2’s configure resetslibexecdirfrom its own--with-libexecdiroption, which defaults to$prefix/libexec, so this switch moves nothing:lvresize_fs_helperis installed in/usr/libexec.--enable-cmdlib— Buildsliblvm2cmd, the LVM commands as a shared library. dmeventd’s LVM plugin links it to run LVM commands.--enable-dmeventdturns it on by itself and configure refuses--disable-cmdlibbeside it; the switch states the setting outright.--enable-pkgconfig— Installsdevmapper.pcand the other pkg-config files, which is how the ports that linklibdevmapperfind it.--enable-udev_sync— LVM and device-mapper wait for udev to finish processing a device before they go on, so the/dev/<vg>/<lv>links exist when a command returns. It also installs the device-mapper udev rules, which create those links. Needs eudev.--enable-dmeventd— Builds dmeventd, the device-mapper event daemon. It is what makeslvm.conf’s monitoring work: a thin pool that extends itself when it fills, and repair of a RAID or mirror volume after a failed leg.--enable-readline— Command-line editing and history in the interactivelvmshell, from readline. Named, a missing readline is a configure error rather than a shell without editing.--with-blkid,--enable-blkid_wiping— Use util-linux’s libblkid to detect the filesystem and RAID signatureslvcreateandpvcreateoffer to wipe, in place of LVM’s own scanner. Enabled outright, a missing libblkid stops configure.--with-libnvme,--enable-nvme-wwid— Use libnvme to find an NVMe device’s alternate WWIDs, among the device IDslvmdevicesrecords for a device. Enabled outright, a missing libnvme stops configure.--with-thin-check=/usr/sbin/thin_checkand the seven other--with-thin-…and--with-cache-…paths — The programs from thin-provisioning-tools that LVM runs before it activates a thin pool or a cached volume. Each is written into the installedlvm.confand into the tools as the default. Given outright, configure does not search for them; built before thin-provisioning-tools, this port would find none./usr/sbinis where that port installs them.--enable-thin_check_needs_check,--enable-cache_check_needs_check— LVM passes the tools--clear-needs-check-flag, whichthin_checkunderstands from 0.3 andcache_checkfrom 0.5.4. Both are on by default, and configure turns each off when its version probe finds an older tool or none at all; with the probes skipped, the switches state the setting outright.--without-systemd— Nolibsystemd, for the journal and the machine ID. KDOS has no systemd (see No systemd).--with-default-event-activation=0— Writesevent_activation = 0as the default inlvm.conf. Event activation means udev activates a volume group as soon as its last physical volume appears; upstream does that through69-dm-lvm.rules, which runssystemd-run … vgchange -aay. With it off,lvm pvscan --checkcompletein that rule does nothing.--disable-selinux— No libselinux; the tree has no SELinux.
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
69-dm-lvm.rulesis deleted from the package. With event activation off it would only runlvm pvscanon every block device event, and the activation it exists for goes throughsystemd-run, which does not exist here. Nothing on hotplug activates a volume group: the boot does it in03_lvm.sh, and by hand it isvgchange -aay.- Thin and cached volumes need thin-provisioning-tools. LVM refuses to activate a thin pool or a cached volume when
thin_checkorcache_checkcannot be run, which is why that port is built and installed beside this one.