We can easily achieve this by adding "lvm" in the checklist.
We need do this, because in case of "nfs" dumping, if "lvm"
is added, the lvm2 under kdump still operates the lvm volume
due to the "rd.lvm.lv=X" inherited from the first kernel.
This patch removes "lvm" from the kdump initramfs in case of
no lvm target, it can reduce several megabytes from initramfs.
Signed-off-by: Xunlei Pang <xlpang(a)redhat.com>
---
mkdumprd | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/mkdumprd b/mkdumprd
index 38b3f12..4eb0dea 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -12,7 +12,7 @@
export IN_KDUMP=1
# See kdump_target_XXX()
-KDUMP_TARGET_CHECKLIST="lvmlinear"
+KDUMP_TARGET_CHECKLIST="lvm lvmlinear"
conf_file="/etc/kdump.conf"
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
@@ -297,6 +297,11 @@ kdump_target_handle()
tag=KDUMP_TARGET_TAG_$item
# the item handling begins
case "$item" in
+ lvm)
+ if ! [[ $pdev =~ "/dev/mapper/" ]]; then
+ return
+ fi
+ ;;
lvmlinear)
if ! [[ $pdev =~ "/dev/mapper/" ]]; then
return
@@ -596,6 +601,11 @@ then
add_dracut_arg "--add-drivers" "$extra_modules"
fi
+# Omit "lvm" dracut module if we have no lvm target.
+if ! kdump_target_check lvm ; then
+ add_dracut_arg "-o" "lvm"
+fi
+
dracut "${dracut_args[@]}" "$@"
_rc=$?
sync
--
1.8.3.1