Bug#455979: activate lvm devices from udev
Scott James Remnant
scott at ubuntu.com
Wed Dec 12 18:48:27 UTC 2007
Package: lvm2
Version: 2.02.26-1
Severity: wishlist
Tags: patch
We activate LVM2 devices from udev, detecting when block devices
containing LVM Physical Volumes are added to the system or changed and
running lvm vgscan and vgchange afterwards.
Please consider migrating to the same.
(This almost certainly depends on our patches to devmapper and mdadm).
-- System Information:
Debian Release: lenny/sid
APT prefers gutsy-updates
APT policy: (500, 'gutsy-updates'), (500, 'gutsy-security'), (500, 'gutsy')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.22-14-generic (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
-------------- next part --------------
--- lvm2-2.02.26/debian/lvm2.postinst
+++ lvm2-2.02.26/debian/lvm2.postinst
@@ -6,6 +6,8 @@
echo -n "Backing up any LVM2 metadata that may exist..."
/sbin/vgcfgbackup >/dev/null 2>&1 || true
echo "done."
+
+ update-initramfs -u
fi
#DEBHELPER#
--- lvm2-2.02.26/debian/control
+++ lvm2-2.02.26/debian/control
@@ -8,10 +9,9 @@
Package: lvm2
Architecture: any
-Depends: ${shlibs:Depends}
+Depends: ${shlibs:Depends}, udev (>= 111-0ubuntu1), initramfs-tools (>= 0.85eubuntu11), dmsetup
Conflicts: lvm-common
Replaces: lvm-common
-Suggests: dmsetup
Description: The Linux Logical Volume Manager
This is LVM2, the rewrite of The Linux Logical Volume Manager. LVM
supports enterprise level volume management of disk and disk subsystems
--- lvm2-2.02.26/debian/rules
+++ lvm2-2.02.26/debian/rules
@@ -130,7 +134,7 @@
# dh_installemacsen -a
# dh_installpam -a
# dh_installmime -a
- dh_installinit -plvm2 --no-start -- start 26 S . start 50 0 6 .
+ dh_installudev -a --priority=85
# dh_installcron -a
# dh_installman -a
# dh_installinfo -a
--- lvm2-2.02.26/debian/initramfs-tools/hooks/lvm2
+++ lvm2-2.02.26/debian/initramfs-tools/hooks/lvm2
@@ -1,6 +1,6 @@
#!/bin/sh
-PREREQ=""
+PREREQ="udev"
prereqs()
{
@@ -22,6 +22,8 @@
-copy_exec /sbin/vgchange /sbin
+copy_exec /sbin/lvm /sbin
+
+cp -p /etc/udev/rules.d/85-lvm2.rules ${DESTDIR}/etc/udev/rules.d
for x in dm_mod dm_snapshot dm_mirror; do
- manual_add_modules ${x}
+ force_load ${x}
done
--- lvm2-2.02.26/debian/initramfs-tools/scripts/local-top/lvm2
+++ lvm2-2.02.26.orig/debian/initramfs-tools/scripts/local-top/lvm2
@@ -1,70 +0,0 @@
-#!/bin/sh
-
-PREREQ="mdadm mdrun"
-
-prereqs()
-{
- echo "$PREREQ"
-}
-
-case $1 in
-# get pre-requisites
-prereqs)
- prereqs
- exit 0
- ;;
-esac
-
-activate_vg()
-{
- local vg="$1"
-
- # Make sure that we have a non-empty argument
- if [ -z "${vg}" ]; then
- return 1
- fi
-
- # Take care of lilo boot arg, risky activating of all vg
- case $vg in
- fe[0-9]*)
- vgchange -ay
- exit 0
- ;;
- # FIXME: check major
- /dev/root)
- vgchange -ay
- exit 0
- ;;
- esac
-
- # Make sure that we have a d-m path
- vg=${vg#/dev/mapper/}
- if [ "$vg" = "$1" ]; then
- return 1
- fi
-
- # Make sure that the device includes at least one dash
- if [ "$(echo -n "$vg" | tr -d -)" = "$vg" ]; then
- return 1
- fi
-
- # Split volume group from logical volume.
- vg=$(echo ${vg} | sed -e 's#\(.*\)\([^-]\)-[^-].*#\1\2#')
- # Reduce padded --'s to -'s
- vg=$(echo ${vg} | sed -e 's#--#-#g')
-
- vgchange -ay ${vg}
-}
-
-if [ ! -e /sbin/vgchange ]; then
- exit 0
-fi
-
-modprobe -q dm-mod
-modprobe -q dm-snapshot
-modprobe -q dm-mirror
-
-activate_vg "$ROOT"
-activate_vg "$resume"
-
-exit 0
--- lvm2-2.02.26.orig/debian/lvm2.udev
+++ lvm2-2.02.26/debian/lvm2.udev
@@ -0,0 +1,6 @@
+# This file causes block devices with LVM signatures to be automatically
+# added to their volume group.
+# See udev(8) for syntax
+
+SUBSYSTEM=="block", ACTION=="add|change", ENV{ID_FS_TYPE}=="lvm*|LVM*", \
+ RUN+="watershed sh -c '/sbin/lvm vgscan; /sbin/lvm vgchange -a y'"
More information about the pkg-lvm-maintainers
mailing list