SUMMARY: Disaster Recover
Wolfgang Schwurack
wolf at uen.org
Fri Jan 21 11:04:33 EST 2005
I had a lot of good replies. The one that I liked the best was from Ed
Alexander who sent me a script that gave me all of the information I
needed to recover from a disaster. see attachment
Some other options
from przemol
Look at the explorer:
http://sunsolve.sun.com/pub-cgi/show.pl?target=explorer/explorer
from Aleksander Pavic
http://www.sun.com/bigadmin/scripts/indexBackup.html
from Prasad Dharmasena
As root, run these to get quite a lot of info about a machine.
/usr/bin/hostname
/usr/bin/domainname
/usr/bin/uname -a
/usr/platform/sun4u/sbin/prtdiag -v
/usr/bin/getconf -a
/etc/mount
/usr/bin/df -k
/usr/bin/netstat -i
>From Bob Bumpus
I've used cfg2html to collect system information. You may want to look
at it.
http://come.to/cfg2html
To All
I am preparing for a Disaster Recovery plan for all of my solaris
server. One of the first steps is to create a script that will collect
the storage structure and other specification of the system. Does
anyone have a script or know of a program the will get all of the
information that one would need if a server fails?
thanks
--
/\ /\ \ O \ Wolfgang Schwurack
/ \\ /\ /\\\ \_/|\_\ Unix System Administrator
/ \\/ \\ / \\\ \\ University of Utah/Utah Education Network
/ \/ \\\ \/' Tel: (801) 587-9444
/ / \\\ \\_ email: wolf at uen.org
/ / \\\ -
#!/bin/sh
#==============================================================================
# $Id: sysconfig,v 1.1 1998/12/01 08:42:23 peters Exp $
#
# NAME: sysconfig
# DESCRIPTION: Shows a summary of useful configuration information on
# Solaris systems.
# DATE: 2 Dec 1998
# AUTHOR: Peter Sundstrom (peters at ginini.com.au)
# SOURCE: http://www.ginini.com.au/tools/sysconfig
#
#==============================================================================
USAGE="Usage: `basename $0` [-Dcdgkhmnprst]"
SCRIPT=`basename $0` # Shortname of this script
RELEASE=`uname -r` # OS Release
PLATFORM=`uname -s` # Machine platform
#------------------------------------------------------------------------------
help ()
{
cat <<EOF
$USAGE
Displays useful configuration information on a Solaris system.
-D Debug mode
-c Crontab files
-d Available Disks
-g General machine configuration
-h Display help
-k Installed packages
-m Mounts and disk usage
-n Network interfaces
-p Disk partitions
-r RAID Metadata
-s Swap space
-t Installed patches
If no options are specified, all information is displayed.
EOF
exit
}
#------------------------------------------------------------------------------
General_info ()
{
[ "$DEBUG" = TRUE ] && set -x
echo "==============================================================================="
echo "==========General Information=================================================="
echo "===============================================================================\n"
showrev | egrep -v "Release"
release=`grep Solaris /etc/release`
echo Release: $release
echo "Machine type: \c"
uname -i
prtconf | grep "Memory size"
maxprocessors=`psrinfo | wc -l`
echo Number of processors: $maxprocessors
if [ $maxprocessors -gt 1 ]
then
processor=0
while [ $processor -lt $maxprocessors ]
do
speed=`psrinfo -v $processor| grep "operates at" | sed "s/.*operates at //"`
echo "Processor $processor: $speed"
processor=`expr $processor + 1`
done
else
speed=`psrinfo -v | grep "operates at" | sed "s/.*operates at //"`
echo "Processor runs at $speed"
fi
return 0
}
#------------------------------------------------------------------------------
Crontab_Files ()
{
[ "$DEBUG" = TRUE ] && set -x
echo "\n"
echo "==============================================================================="
echo "==========Crontabs============================================================="
echo "===============================================================================\n"
for ctab in /var/spool/cron/crontabs/*
do
echo "===Contents of ${ctab}:\n"
/usr/bin/crontab -l `/usr/bin/basename ${ctab}`
echo "\n"
done
return 0
}
#------------------------------------------------------------------------------
Swap_space ()
{
[ "$DEBUG" = TRUE ] && set -x
echo "\n"
echo "==============================================================================="
echo "==========Swap Space==========================================================="
echo "===============================================================================\n"
echo "Swap device Size"
echo "-------------------------------"
swap -l | grep -v swapfile |
while read swapfile dev swaplo blocks free
do
size=`expr $blocks / 2048`
echo "$swapfile\t$size Mb"
done
return 0
}
#------------------------------------------------------------------------------
Mounts_and_Drive_Space ()
{
[ "$DEBUG" = TRUE ] && set -x
echo "\n"
echo "==============================================================================="
echo "==========df and vfstab========================================================"
echo "===============================================================================\n"
echo ""
echo "===df -kl Output:"
/usr/bin/df -kl
echo "\n"
echo "===Contents of /etc/vfstab:\n"
/usr/bin/cat /etc/vfstab
return 0
}
#------------------------------------------------------------------------------
Network_interfaces ()
{
[ "$DEBUG" = TRUE ] && set -x
echo "\n"
echo "==============================================================================="
echo "==========Network Interfaces==================================================="
echo "===============================================================================\n"
echo "Int Host Address"
echo "-------------------------------------------------------------------------------"
# typeset -L7 interface
# typeset -L8 intname
for interface in `ls /etc/hostname.*|sed "s/.*\.//"`
do
intname=`cat /etc/hostname.$interface`
echo "$interface $intname \c"
ifconfig $interface | grep inet | sed "s/^.*inet //"
ifconfig $interface | grep ether
done
return 0
}
#------------------------------------------------------------------------------
Disks ()
{
[ "$DEBUG" = TRUE ] && set -x
echo "\n"
echo "==============================================================================="
echo "==========Available Disks======================================================"
echo "===============================================================================\n"
disks=`echo "0\nq"|format 2>/dev/null |grep "[0-9]\."|sed "s/^ *//"`
echo "$disks"
return 0
}
#------------------------------------------------------------------------------
Disk_partitions ()
{
[ "$DEBUG" = TRUE ] && set -x
echo "\n"
echo "==============================================================================="
echo "==========Disk Partitions======================================================"
echo "===============================================================================\n"
disks=`echo "0\nq"|format 2>/dev/null |grep "[0-9]\."|sed "s/^ *//"`
for disk in `echo "$disks" | awk '{print $2}'`
do
echo "\nDisk $disk"
echo "--------------"
prtvtoc -s /dev/rdsk/${disk}s2
done
return 0
}
#------------------------------------------------------------------------------
RAID_Metadata ()
{
[ "$DEBUG" = TRUE ] && set -x
if [ -d /etc/lvm ]
then
echo "\n"
echo "==============================================================================="
echo "==========RAID Metadata========================================================"
echo "===============================================================================\n"
echo ""
for mfile in md.cf md.ctlrmap md.tab mddb.cf
do
if [ -f /etc/lvm/${mfile} ]
then
echo "\n===Contents of /etc/lvm/${mfile}:\n"
cat /etc/lvm/${mfile}
echo "\n"
fi
done
fi
return 0
}
#------------------------------------------------------------------------------
Installed_packages ()
{
[ "$DEBUG" = TRUE ] && set -x
echo "\n"
echo "==============================================================================="
echo "==========Installed Packages==================================================="
echo "===============================================================================\n"
pkginfo
return 0
}
#------------------------------------------------------------------------------
Installed_patches ()
{
[ "$DEBUG" = TRUE ] && set -x
echo "\n"
echo "================================================================================"
echo "==========Installed Patches====================================================="
echo "================================================================================\n"
showrev -p
return 0
}
#------------------------------------------------------------------------------
# END OF FUNCTIONS
#==============================================================================
#
# Some functions need root access
#
if [ `id|sed -e "s/uid=//" -e "s/(.*//"` != 0 ]
then
echo "$SCRIPT needs to be run as root" >&2
exit 1
fi
#
# Check to see what platform we are running on.
#
if [ $PLATFORM != SunOS ]
then
echo "$SCRIPT can only run on Sun systems" >&2
exit 1
fi
#
# Check to see if we are on Solaris 2.5 (SunOS 5.5) or higher
#
if echo $RELEASE | grep 5.[5-9] >/dev/null 2>&1
then
: # OS level is OK
else
echo "$SCRIPT needs to be run on Solaris version 2.5 and higher" >&2
exit 1
fi
#
# Set an appropriate path
#
PATH=/usr/bin:/usr/sbin
#
# If no parameters are supplied, set flag to indicate to display
# all information.
#
[ $# -eq 0 ] && ALL=TRUE
echo "System configuration as of `/usr/bin/date`"
echo ""
echo "Generated by /home/systems/scripts/${SCRIPT} $*"
echo ""
while getopts :Dcdghkmnprst opt
do
case $opt in
D) DEBUG=TRUE
set -x
;;
c) Crontab_Files
;;
d) Disks
;;
h) help
;;
g) General_info
;;
k) Installed_packages
;;
m) Mounts_and_Drive_Space
;;
n) Network_interfaces
;;
p) Disk_partitions
;;
r) RAID_Metadata
;;
s) Swap_space
;;
t) Installed_patches
;;
?) echo "$USAGE" >&2
exit 1
;;
esac
done
#
# Exit if flags have been specified
#
[ "$ALL" = TRUE ] || exit 0
#
# By default, display all information
#
General_info
Crontab_Files
Swap_space
Mounts_and_Drive_Space
Network_interfaces
Disks
Disk_partitions
RAID_Metadata
Installed_packages
Installed_patches
_______________________________________________
sunmanagers mailing list
sunmanagers at sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
More information about the summaries
mailing list