[PATCH 06/14] limit the devices for which lvm vgscan will scan

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Build the filter list and create /etc/lvm/lvm.conf for all LVM_member
devices found by udev.
---
 modules.d/90lvm/lvm_scan.sh |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh
index cd843aa..489c7a1 100755
--- a/modules.d/90lvm/lvm_scan.sh
+++ b/modules.d/90lvm/lvm_scan.sh
@@ -3,6 +3,25 @@
 if $UDEV_QUEUE_EMPTY >/dev/null 2>&1; then
     [ -h "$job" ] && rm -f "$job"
     # run lvm scan if udev has settled
+
+    [ -d /etc/lvm ] || mkdir -p /etc/lvm
+    # build a list of devices to scan
+    lvmdevs=$(
+	for f in /tmp/.lvm_scan-*; do
+	    [ -e "$f" ] || continue
+	    echo ${f##/tmp/.lvm_scan-}
+	done
+	)
+    {
+	echo 'devices {';
+	echo -n '    filter = [ '
+	for dev in $lvmdevs; do
+	    printf '"a|^/dev/%s$|", ' $dev;
+	done;
+	echo '"r/.*/" ]';
+	echo '}';	  
+    } > /etc/lvm/lvm.conf
+
     lvm vgscan
     lvm vgchange -ay
 fi
-- 
1.6.2.5

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux