If default target is a separate disk, the related information need be
stored in /etc/kdump.conf of kdump initramfs. This includes the disk
info which will help to deduce the dump_code and path which the vmcore
will be written into.
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
dracut-module-setup.sh | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index bdadf7c..ce6f94a 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -261,6 +261,41 @@ kdump_install_net() {
fi
}
+
+store_default_dump_target_conf()
+{
+ local _target
+ local _s _t
+ local _mntpoint
+ local _ret
+ local _path _save_path
+
+ _save_path=$(grep ^path "/etc/kdump.conf"| cut -d' ' -f2)
+ [ -z "$_save_path" ] && _save_path="/var/crash"
+
+ _target=$(get_user_configured_dump_disk)
+ [ -n "$_target" ] && return
+
+ _target=$(get_root_fs_device)
+ if [ -b "$_target" ]; then
+ mkdir -p $_save_path
+ _ret=$?
+ if [ $_ret -ne 0 ]; then
+ perror_exit "mkdir failed on $_save_path"
+ fi
+ _mntpoint=$(df $_save_path| tail -1 | awk '{print $NF}')
+ if [ "$_mntpoint" != "/" ]; then
+ _s=$(findmnt -k -f -n -o SOURCE $_mntpoint)
+ _t=$(findmnt -k -f -n -r -o FSTYPE $_s)
+ _s=$(kdump_to_udev_name $_s)
+ echo "$_t $_s" >> /tmp/$$-kdump.conf
+
+ _path=$(echo $_save_path | sed "s,$_mntpoint,,")
+ sed -i -e "s#$_save_path#$_path#" /tmp/$$-kdump.conf
+ fi
+ fi
+}
+
#install kdump.conf and what user specifies in kdump.conf
kdump_install_conf() {
sed -ne '/^#/!p' /etc/kdump.conf > /tmp/$$-kdump.conf
@@ -285,6 +320,8 @@ kdump_install_conf() {
esac
done < /etc/kdump.conf
+ store_default_dump_target_conf
+
kdump_check_fence_kdump
inst "/tmp/$$-kdump.conf" "/etc/kdump.conf"
rm -f /tmp/$$-kdump.conf
--
1.8.5.3