From c7cc8fcb553c0deca7ce92c13f4ff129e7d9cc8d Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 9 Jun 2006 23:10:00 +0000 Subject: [PATCH] Branch b1_5 b=9860 Add upgrade helper script per Andreas' suggestion --- lustre/scripts/Makefile.am | 2 +- lustre/scripts/lustre_up14.sh | 56 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100755 lustre/scripts/lustre_up14.sh diff --git a/lustre/scripts/Makefile.am b/lustre/scripts/Makefile.am index f25c75f..6b582ea 100644 --- a/lustre/scripts/Makefile.am +++ b/lustre/scripts/Makefile.am @@ -2,7 +2,7 @@ # # This code is issued under the GNU General Public License. # See the file COPYING in this distribution -sbin_SCRIPTS = lustre_config.sh lc_modprobe.sh lc_net.sh lc_hb.sh lc_mon.sh lc_cluman.sh lc_servip.sh lustre_createcsv.sh +sbin_SCRIPTS = lustre_config.sh lc_modprobe.sh lc_net.sh lc_hb.sh lc_mon.sh lc_cluman.sh lc_servip.sh lustre_createcsv.sh lustre_up14.sh EXTRA_DIST = $(sbin_SCRIPTS) license-status maketags.sh \ version_tag.pl.in diff --git a/lustre/scripts/lustre_up14.sh b/lustre/scripts/lustre_up14.sh new file mode 100755 index 0000000..0341783 --- /dev/null +++ b/lustre/scripts/lustre_up14.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# +# Reads old MDS config logs for transferring to a MGS +# +############################################################################### + +TMP=/tmp/logs + +# Usage +usage() { + cat >&2 < + + the MDS disk device (e.g. /dev/sda1) + the name of the new filesystem (e.g. testfs) + + This program will copy old config logs from an MDS device to + a temporary location ($TMP), from where they can be added to + the CONFIGS directory on an MGS during the upgrade procedure. + +EOF + exit 1 +} + +if [ $# -lt 2 ]; then + usage +fi + +DEV=$1 +FSNAME=$2 +DEBUGFS="debugfs -c -R" +mkdir -p $TMP + +FILES=`$DEBUGFS "ls -l LOGS" $DEV | awk '{print $9}' | awk '/[a-z]/ {print $1}'` + +for FILE in ${FILES}; do + $DEBUGFS "dump LOGS/$FILE $TMP/temp" $DEV 2> /dev/null + CLI=`strings $TMP/temp | grep MDC` + if [ -n "$CLI" ]; then + TYPE=client + else + TYPE=MDT0000 + fi + echo -n "Copying log $FILE to ${FSNAME}-${TYPE}. Okay [y/n]?" + read OK + if [ "$OK" = "y" ]; then + mv $TMP/temp $TMP/${FSNAME}-${TYPE} + else + rm $TMP/temp + fi +done + +echo ls -l $TMP +ls -l $TMP + -- 1.8.3.1