www.mass.dk

Sharing what I know...

  • Increase font size
  • Default font size
  • Decrease font size
Welcome to the Frontpage

How to retrieve tape drive serial numbers with sg_inq

This small pice of code let you retrive what tape drive serial numbers are diffrent OS device drivers.

#!/usr/bin/ksh
OS=`uname`
if [ $OS != "Linux" ]
 then
 echo "Script will not work on non-linux variants" 
 exit 1
fi
if [ ! -f /usr/bin/sg_inq ]
then
 echo "sg_inq command not found. Do you have the sg3_util package installed ?"
 exit 1
fi
tpconfig -l | grep drive | grep "/dev/n" | awk '{ print $8 " "$9 }' | while read NAME DEVICE
do
 echo -n "Drive $NAME, $DEVICE"
 /usr/bin/sg_inq $DEVICE | grep "serial"
done

Output will look like this:
# ./get_device_serial_number

Drive 0315-2F, /dev/nst5 Unit serial number: HU19477MA8
Drive 0011-2F, /dev/nst0 Unit serial number: HU10623E8J
Drive 0116-2F, /dev/nst4 Unit serial number: HU1052790W
Drive 10115-TN, /dev/nst1sg_inq: error opening file: /dev/nst1: Device or resource busy

A "Device or resource busy" mean the tape drives is busy (e.g using SSO)  - this will prevent sg_inq from reading the tape drive serial number.

Last Updated on Wednesday, 20 February 2013 14:29
 

EMC Data Domain and default gateway

The Data Domain command reference is unclear (you could say misleading) when using the CLI to configure a default gateway

This is from the EMC 5.2 command reference:

set
route set gateway {<ipaddr> | <ipv6addr>}
Change the routing default gateway.
Example
To set the default routing gateway to the IP address of 192.168.1.2:
# route set gateway 192.168.1.2

However this command only set the gateway registry key for next reboot - it does not apply it to the running setup. To set a default gateway on a running system use:

# route add default gateway 192.168.1.254

And yes this command is NOT documented in the command reference Yell. Run both commands and verify with :

# route show gateway
IPV4 Default Gateway
192.168.1.254
IPV6 Default Gateway
fe80::21e:f6ff:febf:3041
Last Updated on Tuesday, 27 November 2012 16:47
 

How to find MS SQL database not excluded from file system backups using bplist

Very often MS SQL databases don’t get excluded from the ordinary file system backup. This result in huge incremental backup, good for absolutely nothing since the SQL database is not consistent at point of backup. Luckily it’s very easy to be on top on this issuec and find those database files using Netbackup bplist utility.

This is a Korn Shell script that does the job:

# A simple script that can assist the Netbackup admin finding MS SQL database files not excluded from the regular file system backup
#
POLICY=$1
if [ $# -ne 1 ]
then
echo "Policy name missing !!"
exit 1
fi

# Calgulate how many days back we look. Adjust the "2 days ago" section to go longer back.
EPOCH_DATE=`date --date='2 days ago' +%s`
BPLIST_STRING_DATE=`date -d @${EPOCH_DATE} +%m/%d/%Y `

# Retrieve a list of client in the policy choose . Since bplist terminate each line with a null byte we need to use sed
# to get rid of it else grep doesn't match any mdf ndf or ldf files.

/usr/openv/netbackup/bin/admincmd/bppllist ${POLICY} | grep CLIENT | awk '{ print $2 }' | while read CLIENT
do
echo "Processing ${CLIENT}"
echo
/usr/openv/netbackup/bin/bplist -B -C ${CLIENT} -R -l -t 13 -s ${BPLIST_STRING_DATE} / | sed 's/\x0//g' |  grep -i -a -e  "\.mdf$" -e "\.ndf$" -e "\.ldf$"
echo
done

The script assumes the policy you specify is type 13 (Windows). If you run the script using a type 0 (standard) policy a  “EXIT STATUS 227: no entity was found” will be returned.

Output from script:

Processing srv1.acme.com

Processing srv2.acme.com
-rwx------ root      root        524288000 Mar 15 06:53 /D/SqlData/TempDB/MSSQLSERVER/tempdb2.ndf
-rwx------ root      root        524288000 Mar 15 06:53 /D/SqlData/TempDB/MSSQLSERVER/tempdb3.ndf
-rwx------ root      root        524288000 Mar 15 06:53 /D/SqlData/TempDB/MSSQLSERVER/tempdb4.ndf
-rwx------ root      root        524288000 Mar 15 06:53 /D/SqlData/TempDB/MSSQLSERVER/tempdb5.ndf
-rwx------ root      root        524288000 Mar 15 06:53 /D/SqlData/TempDB/MSSQLSERVER/tempdb6.ndf
-rwx------ root      root        524288000 Mar 15 06:53 /D/SqlData/TempDB/MSSQLSERVER/tempdb7.ndf
-rwx------ root      root        524288000 Mar 15 06:53 /D/SqlData/TempDB/MSSQLSERVER/tempdb8.ndf

Processing srv3.acme.com

Last Updated on Wednesday, 20 June 2012 08:20
 
  • «
  •  Start 
  •  Prev 
  •  1 
  •  2 
  •  3 
  •  4 
  •  5 
  •  6 
  •  7 
  •  8 
  •  9 
  •  10 
  •  Next 
  •  End 
  • »


Page 1 of 10