Hello,
This is an RFC patch intended to first review basic design of --split option support.
This version automatically appends --split option if more than 1 cpu is available on kdump 2nd kernel. I guess someone propably doesn't like the situation that multiple vmcores are generated implicitly without any explicit user operation. So, I'd like comments on this design first.
Another idea is to introduce a new directive to specify the number of vmcores into which we split /proc/vmcore, and then we append --split option if and only if the directive is specified with the value more than 1 cpu.
>From e6afa242829768ee0b9e58637444acf3fed4b442 Mon Sep 17 00:00:00 2001
From: HATAYAMA Daisuke <d.hatayama(a)jp.fujitsu.com>
Date: Tue, 25 Mar 2014 17:09:42 +0900
Subject: [PATCH] Add --split support for dump on filesystem
This commit implement makedumpfile --split option support, allowing
filtering and compression in paralell.
In this design, --split option is automatically appended if more than
1 cpu is available. Also, the number of generated dump files are
automatically decided to the number of online cpus.
To support --split option for dump on network, it's necessary to add
new feature in makedumpfile to make it possible to specify --split
option and -F option at the same time. This is going to be done
separately.
Signed-off-by: HATAYAMA Daisuke <d.hatayama(a)jp.fujitsu.com>
---
dracut-kdump.sh | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index d9e65ac..76494ab 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -88,6 +88,8 @@ dump_fs()
{
local _dev=$(findmnt -k -f -n -r -o SOURCE $1)
local _mp=$(findmnt -k -f -n -r -o TARGET $1)
+ local _savedir="$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR"
+ local _nr_cpus=$(grep processor /proc/cpuinfo | wc -l)
echo "kdump: dump target is $_dev"
@@ -100,16 +102,23 @@ dump_fs()
# Remove -F in makedumpfile case. We don't want a flat format dump here.
[[ $CORE_COLLECTOR = *makedumpfile* ]] && CORE_COLLECTOR=`echo $CORE_COLLECTOR | sed -e "s/-F//g"`
- echo "kdump: saving to $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/"
+ echo "kdump: saving to $_savedir"
mount -o remount,rw $_mp || return 1
- mkdir -p $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR || return 1
+ mkdir -p $_savedir || return 1
- save_vmcore_dmesg_fs ${DMESG_COLLECTOR} "$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/"
+ save_vmcore_dmesg_fs ${DMESG_COLLECTOR} "$_savedir"
echo "kdump: saving vmcore"
- $CORE_COLLECTOR /proc/vmcore $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore-incomplete || return 1
- mv $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore-incomplete $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore
+ if [[ $CORE_COLLECTOR = *makedumpfile* && $_nr_cpus > 1 ]] ; then
+ $CORE_COLLECTOR --split /proc/vmcore $(seq -s " " -f "$_savedir/vmcore-incomplete-%g" $_nr_cpus) || return 1
+ for i in $(seq $_nr_cpus); do
+ mv $_savedir/vmcore-incomplete-$i $_savedir/vmcore-$i
+ done
+ else
+ $CORE_COLLECTOR /proc/vmcore $_savedir/vmcore-incomplete || return 1
+ mv $_savedir/vmcore-incomplete $_savedir/vmcore
+ fi
sync
echo "kdump: saving vmcore complete"
--
1.8.5.3