From: Kenneth D'souza <kdsouza(a)redhat.com>
Changes since v1: Added warning instead of error.
Currently the kdumpctl script doesn't check if the raw device is
formatted which might destroy existing data at the time of dump
capture.
This patch addresses this issue, by ensuring kdumpctl prints
a warning in case it finds the raw device to be formatted.
Signed-off-by: Kenneth D'souza <kdsouza(a)redhat.com>
---
kdumpctl | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kdumpctl b/kdumpctl
index 6a01c13..201586c 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -779,6 +779,11 @@ save_raw()
echo "raw partition $raw_target not found"
return 1
}
+ check_fs=$(lsblk --nodeps -npo FSTYPE $raw_target)
+ if [[ $(echo $check_fs | wc -w) -ne 0 ]]; then
+ echo "Warning: Detected '$check_fs' signature on
$raw_target, data loss is expected."
+ return 0
+ fi
kdump_dir=`grep ^path $KDUMP_CONFIG_FILE | cut -d' ' -f2-`
if [ -z "${kdump_dir}" ]; then
coredir="/var/crash/`date +"%Y-%m-%d-%H:%M"`"
--
2.14.3