]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut.sh: introduce "--no-hostonly-default-device" argument
authorXunlei Pang <xlpang@redhat.com>
Wed, 16 Aug 2017 05:55:17 +0000 (13:55 +0800)
committerXunlei Pang <xlpang@redhat.com>
Fri, 18 Aug 2017 01:58:08 +0000 (09:58 +0800)
Kdump doesn't need default host devices like root, swap, fstab, etc,
we only care about the dump target which can be added via "--mount"
or "--add-device". We met several issues that kdump kernel failed
due to one of those host devices added by dracut, additionally, the
needless devices(e.g. LVM) consume some appreciable amount of memory
which is more likely to cause OOM under memory-limited kdump.

So this patch introduced "--no-hostonly-default-device" to avoid
adding those default devices as host_devs.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>
dracut.8.asc
dracut.sh

index ca16918981564d60c5e415ce625f75e31e8f3a23..23c53cc4997b08ffabc4dd9ad60be7443d2d688f 100644 (file)
@@ -323,6 +323,10 @@ provide a valid _/etc/fstab_.
 **--no-hostonly-cmdline**:
     Do not store kernel command line arguments needed in the initramfs
 
+**--no-hostonly-default-device**:
+    Do not generate implicit host devices like root, swap, fstab, etc.
+    Use "--mount" or "--add-device" to explicitly add devices as needed.
+
 **--hostonly-i18n**:
     Install only needed keyboard and font files according to the host configuration (default).
 
index 3a136d46d4289369853b1704e5b97b06c3805cfe..8d7ee70ae9670c5faa0733c97e7190c6497fe4cd 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -151,6 +151,10 @@ Creates initial ramdisk images for preloading modules
                         in the initramfs
   --no-hostonly-cmdline Do not store kernel command line arguments needed
                         in the initramfs
+  --no-hostonly-default-device
+                        Do not generate implicit host devices like root,
+                        swap, fstab, etc. Use "--mount" or "--add-device"
+                        to explicitly add devices as needed.
   --hostonly-i18n       Install only needed keyboard and font files according
                         to the host configuration (default).
   --no-hostonly-i18n    Install all keyboard and font files available.
@@ -345,6 +349,7 @@ rearrange_params()
         --long no-host-only \
         --long hostonly-cmdline \
         --long no-hostonly-cmdline \
+        --long no-hostonly-default-device \
         --long persistent-policy: \
         --long fstab \
         --long help \
@@ -539,6 +544,8 @@ while :; do
                        i18n_install_all_l="yes" ;;
         --no-hostonly-cmdline)
                        hostonly_cmdline_l="no" ;;
+        --no-hostonly-default-device)
+                       hostonly_default_device="no" ;;
         --persistent-policy)
                        persistent_policy_l="$2";       PARMS_TO_STORE+=" '$2'"; shift;;
         --fstab)       use_fstab_l="yes" ;;
@@ -1133,7 +1140,7 @@ if (( ${#add_device_l[@]} )); then
     push_host_devs "${add_device_l[@]}"
 fi
 
-if [[ $hostonly ]]; then
+if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
     # in hostonly mode, determine all devices, which have to be accessed
     # and examine them for filesystem types