From: Kenneth D'souza <kdsouza(a)redhat.com>
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 that the kdumpctl
errors out 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..bb4e576 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 "Detected $check_fs signature on $raw_target"
+ return 1
+ 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