kdump now dumps vmcore to root partition by default in SAVE_PATCH
directory, e.g /var/crash defaultly. This is problematic when another
disk is mounted on /var or /var/crash, because the saved vmcore will
he hidden after dump in 1st kernel. This also has the potential of
blindly filling the root file system without a clue as to why.
Now fix this by failing the loading of kdump kernel if dump target
is root fs by default while different disk is mounted on save path.
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
mkdumprd | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/mkdumprd b/mkdumprd
index bc002bc..d30b34c 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -453,6 +453,34 @@ check_resettable()
return 1
}
+check_block_dump_target()
+{
+ local _target
+ local _mntpoint
+
+ if is_ssh_dump_target || is_nfs_dump_target; then
+ return
+ fi
+
+ _target=$(egrep "^ext[234]|^xfs|^btrfs|^minix|^raw" /etc/kdump.conf
2>/dev/null |awk '{print $2}')
+ [ -n "$_target" ] && return
+
+ #get rootfs device name
+ _target=$(findmnt -k -f -n -o SOURCE /)
+ if [ -b "$_target" ]; then
+ mkdir -p $SAVE_PATH
+ _mntpoint=`df $SAVE_PATH | tail -1 | awk '{print $NF}'`
+ _target=`df $SAVE_PATH | tail -1 | awk '{print $1}'`
+ if [ "$_mntpoint" != "/" ]; then
+ perror "Currently SAVE_PATH is $SAVE_PATH, $_target is mounted on
$_mntpoint. While dump target is root filesystem by default."
+ perror_exit "Then vmcore will be hidden in 1st kernel after dump. Please
check /etc/kdump.conf clearly to remove confusion!"
+ fi
+ fi
+
+}
+
+check_block_dump_target
+
if ! check_resettable; then
exit 1
fi
--
1.8.3.1