summaryrefslogtreecommitdiff
path: root/save_disk_geom
blob: e208aed03f1945a15969d14a65a62c33ee38d299 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /bin/sh
# $Id: save_disk_geom,v 1.16 2020-06-01 03:41:52 admin Exp $

PATH=$PATH:/sbin:/usr/sbin:/ext/bin

ADA=`cd /dev; ls ada[0-9]* 2> /dev/null | egrep "^ada[0-9]+\$"`
DA=`cd /dev; ls da[0-9]* 2> /dev/null | egrep "^da[0-9]+\$"`

gpart show

if kldstat | grep -q "\Wgeom_vinum\W" || \
	sysctl kern.geom.conftxt | grep -q VINUM
then
	gvinum printconfig 2>&1
else
	if vinum info > /dev/null 2>&1
	then
		vinum printconfig 2>&1
	fi
fi

if kldstat | grep -q "\Wzfs\W" || \
	test "0`sysctl -n kstat.zfs.misc.arcstats.size 2> /dev/null`" -gt 0
then
    	zpool status
	zpool get all `zpool list -o name -H`
	zfs get all
fi

if test -e /usr/local/sbin/smartctl ; then
	for Drive in $ADA $DA
	do
		dd if=/dev/$Drive of=/dev/null bs=64k count=1 >/dev/null 2>&1
		echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
    		echo "%%%%% S.M.A.R.T. data for $Drive %%%%%"
		echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
		echo ""
    		/usr/local/sbin/smartctl -s on /dev/$Drive > /dev/null
		/usr/local/sbin/smartctl -x /dev/$Drive
	done
else
	echo smartctl not found/not installed!
fi