This is the mail archive of the lvm2-cvs@sourceware.org mailing list for the LVM2 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

LVM2 ./WHATS_NEW scripts/lvm_dump.sh


CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-10-05 18:42:33

Modified files:
	.              : WHATS_NEW 
Added files:
	scripts        : lvm_dump.sh 

Log message:
	Add lvm_dump.sh script to create a tarball of debugging info from a system.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.452&r2=1.453
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/lvm_dump.sh.diff?cvsroot=lvm2&r1=NONE&r2=1.1

--- LVM2/WHATS_NEW	2006/10/05 13:55:50	1.452
+++ LVM2/WHATS_NEW	2006/10/05 18:42:33	1.453
@@ -1,5 +1,6 @@
 Version 2.02.11 - 
 =====================================
+  Add lvm_dump.sh script to create a tarball of debugging info from a system.
   Capture error messages in clvmd and pass them back to the user.
   Remove unused #defines from filter-md.c.
   Make clvmd restart init script wait until clvmd has died before starting it.
/cvs/lvm2/LVM2/scripts/lvm_dump.sh,v  -->  standard output
revision 1.1
--- LVM2/scripts/lvm_dump.sh
+++ -	2006-10-05 18:42:33.809564000 +0000
@@ -0,0 +1,118 @@
+#!/bin/bash
+#
+# lvm_dump: This script is used to collect pertinent information for
+#           the debugging of lvm issues.
+#
+
+function usage {
+	echo "$0 [options]"
+	echo "    -h print this message"
+	echo "    -a advanced collection - warning: if lvm is already hung,"
+	echo "       then this script may hang as well if -a is used"
+	echo "    -m gather LVM metadata from the PVs"
+	echo "    -d dump directory to place data in (default=/tmp/lvm_dump.\$\$)"
+	echo "    -c if running clvmd, gather cluster data as well"
+	echo ""
+	
+	exit 1
+}
+
+advanced=0
+clustered=0
+metadata=0
+while getopts :acd:hm opt; do
+	case $opt in 
+		a)	advanced=1 ;;
+		c)	clustered=1 ;;
+		d)	lvm_dir=$OPTARG ;;
+		h)	usage ;;
+		m)	metadata=1 ;;
+		:)	echo "$0: $OPTARG requires a value:"; usage ;;
+		\?)     echo "$0: unknown option $OPTARG"; usage ;;
+		*)	usage ;;
+	esac
+done
+
+dir=`mktemp -d -p /tmp lvm_dump.XXXXXX` || exit 2
+lvm_dir="$dir/lvm_dump"
+
+echo " "
+echo "Creating dump directory: $lvm_dir"
+echo " "
+
+mkdir -p $lvm_dir || exit 3
+
+if (( $advanced )); then
+	echo "Gathering LVM volume info..."
+
+	echo "  vgscan..."
+	vgscan -vvvv > $lvm_dir/vgscan 2>&1
+
+	echo "  pvscan..."
+	pvscan -v >> $lvm_dir/pvscan 2>/dev/null
+
+	echo "  lvs..."
+	lvs -a -o +devices >> $lvm_dir/lvs 2>/dev/null
+
+	echo "  pvs..."
+	pvs -a -v > $lvm_dir/pvs 2>/dev/null
+
+	echo "  vgs..."
+	vgs -v > $lvm_dir/vgs 2>/dev/null
+fi
+
+if (( $clustered )); then
+	echo "Gathering cluster info..."
+	echo "STATUS: " > $lvm_dir/cluster_info
+	echo "----------------------------------" >> $lvm_dir/cluster_info
+	cman_tool status >> $lvm_dir/cluster_info
+	echo " " >> $lvm_dir/lvm_info
+
+	echo "SERVICES: " >> $lvm_dir/cluster_info
+	echo "----------------------------------" >> $lvm_dir/cluster_info
+	cman_tool services >> $lvm_dir/cluster_info
+	echo " " >> $lvm_dir/lvm_info
+fi
+
+echo "Gathering LVM & device-mapper version info..."
+echo "LVM VERSION:" > $lvm_dir/versions
+lvs --version >> $lvm_dir/versions
+echo "DEVICE MAPPER VERSION:" >> $lvm_dir/versions
+dmsetup --version >> $lvm_dir/versions
+
+echo "Gathering dmsetup info..."
+dmsetup info -c > $lvm_dir/dmsetup_info
+dmsetup table > $lvm_dir/dmsetup_table
+dmsetup status > $lvm_dir/dmsetup_status
+
+echo "Gathering process info..."
+ps alx > $lvm_dir/ps_info
+
+echo "Gathering console messages..."
+tail -n 75 /var/log/messages > $lvm_dir/messages
+
+echo "Gathering /etc/lvm info..."
+cp -a /etc/lvm $lvm_dir/lvm
+
+echo "Gathering /dev listing..."
+ls -la /dev > $lvm_dir/dev_listing
+
+if (( $metadata )); then
+	echo "Gathering LVM metadata from Physical Volumes..."
+
+	mkdir -p $lvm_dir/metadata
+
+	for pv in `pvs --noheadings -o name`
+	do
+		echo "  $pv"
+		name=`basename $pv`
+		dd if=$pv of=$lvm_dir/metadata/$name bs=512 count=`pvs --noheadings --nosuffix --units s -o pe_start $pv | tr -d \ `
+	done 2>/dev/null
+fi
+
+lvm_dump=$lvm_dir.tgz
+echo "Creating tarball $lvm_dump..."
+tar czf $lvm_dump $lvm_dir 2>/dev/null
+
+exit 0
+


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]