public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: agk@sourceware.org
To: lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW scripts/lvm_dump.sh
Date: Thu, 05 Oct 2006 18:42:00 -0000	[thread overview]
Message-ID: <20061005184233.24246.qmail@sourceware.org> (raw)

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
+


             reply	other threads:[~2006-10-05 18:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-05 18:42 agk [this message]
2006-11-23 17:23 agk
2007-04-25 14:49 bmr
2007-07-02 20:18 mbroz
2007-08-09  9:53 pcaulfield
2007-10-02 15:48 mornfall
2007-10-02 16:09 mornfall
2008-08-28 10:40 mbroz
2009-01-06 18:03 mbroz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061005184233.24246.qmail@sourceware.org \
    --to=agk@sourceware.org \
    --cc=lvm2-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).