1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-09 01:18:39 +03:00
lvm2/scripts/lvm-devices-import.service

13 lines
232 B
SYSTEMD
Raw Normal View History

Allow system.devices to be automatically created on first boot An OS installer can create system.devices for the system and disks, but an OS image cannot create the system-specific system.devices. The OS image can instead configure the image so that lvm will create system.devices on first boot. Image preparation steps to enable auto creation of system.devices: - create empty file /etc/lvm/devices/auto-import-rootvg - remove any existing /etc/lvm/devices/system.devices - enable lvm-devices-import.path - enable lvm-devices-import.service On first boot of the prepared image: - udev triggers vgchange -aay --autoactivation event <rootvg> - vgchange activates LVs in the root VG - vgchange finds the file /etc/lvm/devices/auto-import-rootvg, and no /etc/lvm/devices/system.devices, so it creates /run/lvm/lvm-devices-import - lvm-devices-import.path is run when /run/lvm/lvm-devices-import appears, and triggers lvm-devices-import.service - lvm-devices-import.service runs vgimportdevices --rootvg --auto - vgimportdevices finds /etc/lvm/devices/auto-import-rootvg, and no system.devices, so it creates system.devices containing PVs in the root VG, and removes /etc/lvm/devices/auto-import-rootvg and /run/lvm/lvm-devices-import Run directly, vgimportdevices --rootvg (without --auto), will create a new system.devices for the root VG, or will add devices for the root VG to an existing system.devices. (cherry picked from commit c609dedc2f035f770b5f645c4695924abf15c2ca) (cherry picked from commit 3321a669d8f2df99df9d6dcd4ebb2b4d30731c7a)
2024-04-24 01:08:26 +03:00
[Unit]
Description=Create lvm system.devices
[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/usr/sbin/vgimportdevices --rootvg --auto
ConditionPathExists=!/etc/lvm/devices/system.devices
[Install]
WantedBy=multi-user.target