Download  Print this page

Advertisement

driverinfo="$driver:$name"
fi
hosts="$hosts $num"
echo "Host adapter $num ($driverinfo) found."
done
done
}
# Test if SCSI device $host $channen $id $lun exists
# Outputs description from /proc/scsi/scsi, returns new
testexist ()
{
grepstr="scsi$host Channel: 0*$channel Id: 0*$id Lun: 0*$lun"
new=`cat /proc/scsi/scsi | grep -e"$grepstr"`
if test ! -z "$new"; then
cat /proc/scsi/scsi | grep -e"$grepstr"
cat /proc/scsi/scsi | grep -A2 -e"$grepstr" | tail -n2 | pr -o4 -l1
fi
}
# Perform search (scan $host)
dosearch ()
{
for channel in $channelsearch; do
for id in $idsearch; do
for lun in $lunsearch; do
new=
devnr="$host $channel $id $lun"
echo "Scanning for device $devnr ..."
printf "${yellow}OLD: $norm"
testexist
if test ! -z "$remove" -a ! -z "$new"; then
# Device exists and we're in remove mode, so remove and readd
echo "scsi remove-single-device $devnr" >/proc/scsi/scsi
echo "scsi add-single-device $devnr" >/proc/scsi/scsi
printf "\r\x1b[A\x1b[A\x1b[A${yellow}OLD: $norm"
testexist
if test -z "$new"; then
printf "\r${red}DEL: $norm\r\n\n\n\n"; let rmvd+=1;
fi
fi
if test -z "$new"; then
# Device does not exist, try to add
printf "\r${green}NEW: $norm"
echo "scsi add-single-device $devnr" >/proc/scsi/scsi
testexist
if test -z "$new"; then
# Device not present
printf "\r\x1b[A";
# Optimization: if lun==0, stop here (only if in non-remove mode)
if test $lun = 0 -a -z "$remove" -a $optscan = 1; then
break;
fi
else
let found+=1;
fi
fi
done
done
done
}
# main
if test @$1 = @--help -o @$1 = @-h -o @$1 = @-?; then
echo "Usage: rescan-scsi-bus.sh [options] [host [host ...]]"
echo "Options:"
echo " -l activates scanning for LUNs 0-7
echo " -w scan for target device IDs 0 .. 15 [default: 0-7]"
echo " -c enables scanning of channels 0 1
echo " -r enables removing of devices
echo "--remove:
echo "--nooptscan:
echo "--color:
echo "--hosts=LIST:
echo "--channels=LIST: Scan only channel(s) in LIST"
echo "--ids=LIST:
echo "--luns=LIST:
same as -r"
don't stop looking for LUNs is 0 is not found"
use coloured prefixes OLD/NEW/DEL"
Scan only host(s) in LIST"
Scan only target ID(s) in LIST"
Scan only lun(s) in LIST"
[default: 0]"
[default: 0]"
[default: disabled]"
4

Advertisement

Table of Contents

   Related Manuals for HP xw3400

This manual is also suitable for:

Xw4100Xw4300Xw4400Xw4550Xw4600Xw6000 ... Show all

Comments to this Manuals

Symbols: 0
Latest comments: