ZFS getinfo script

#!/bin/ksh
#### start of zfs_getinfo script
#### Copyright 2004 Sun Microsystems, Inc.
#### Use of this script is AT YOUR OWN RISK.
#### There are NO WARRANTIES provided with this script.

STAMP=`/usr/bin/date +%Y%m%d%H%M%S`

TMPDIR="/tmp/ZFS.$STAMP"
TARFILE="ZFS.${STAMP}.tar"

/usr/bin/mkdir -p $TMPDIR/kstats

ZPOOLLIST=`/usr/bin/zpool ls`
for zp in $ZPOOLLIST; do
/usr/bin/cp /etc/zpool/$zp $TMPDIR
ZFSLIST=`/usr/bin/zfs ls $zp`
for zf in $ZFSLIST; do
/usr/bin/zfs getprop $zfs >> $TMPDIR/zfs_ls_${zp} 2>&1
done
done

/usr/bin/pkginfo -l SUNWzfs > $TMPDIR/pkginfo-l.SUNWzfs 2>&1

/usr/bin/zpool vdevs -v > $TMPDIR/zpool_vdevs_-v 2>&1
/usr/bin/zpool devices -v > $TMPDIR/zpool_devices_-v 2>&1

/usr/sbin/modinfo |/usr/bin/egrep -i "zfs|zpool|zvol" > $TMPDIR/modinfo 2>&1

/usr/bin/kstat -m zfs > $TMPDIR/kstats/zfs
/usr/bin/kstat -m unix -n zfs_znode_cache > $TMPDIR/kstats/unix.zfs_znode_cache
/usr/bin/kstat -m unix -n zil_dobj_cache > $TMPDIR/kstats/unix.zil_dobj_cache
/usr/bin/kstat -m unix -n zil_itx_cache > $TMPDIR/kstats/unix.zil_itx_cache
/usr/bin/kstat -m unix -n zfs_taskq > $TMPDIR/kstats/unix.zfs_taskq
/usr/bin/kstat -m unix -n spa_zio_issue > $TMPDIR/kstats/unix.spa_zio_issue
/usr/bin/kstat -m unix -n spa_zio_intr > $TMPDIR/kstats/unix.spa_zio_intr

/usr/bin/echo "zpool_version/s" | /usr/bin/mdb -k > $TMPDIR/mdb_zpool_version 2>&1
/usr/bin/echo "zfs_intent_log_disable/x" |/usr/bin/mdb -k > $TMPDIR/mdb_zil_disable 2>&1

echo "Now bundling for transfer to Sun"

cd /tmp
/usr/bin/tar cvf /tmp/${TARFILE} $TMPDIR
/usr/bin/gzip -9 /tmp/${TARFILE}

echo "Please forward the file /tmp/${TARFILE}.gz to Sun"

rm -rf $TMPDIR

#### end of zfs_getinfo script

Leave a Reply

Your email address will not be published. Required fields are marked *