Hard SUN
De DocUnix.
Sommaire |
Déterminer les chemins disques sur SAN et Veritas sur Solaris 10
Le sar utilise des références type ssdxx. Or avec Véritas les références disques apparaissent comme cxtyyyyyyydzsn avec la commande "vxdisk list", comment déterminer la correspondance avec les sddxx notifiés par le sar.
Premiere methode
La première commande permettant de faire une première correspondance est la conjonction entre iostat -nx et iostat -x.
iostat -nx :
extended device statistics
r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device
0.7 1.9 9.7 14.4 0.0 0.1 2.0 19.4 0 1 c3t0d0
0.8 1.9 9.9 14.4 0.0 0.0 1.4 15.4 0 1 c3t1d0
0.1 0.7 3.6 4.5 0.0 0.0 0.0 20.6 0 0 c3t2d0
0.1 0.6 3.7 4.4 0.0 0.0 0.0 16.0 0 0 c3t3d0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.1 0 0 c2t0d0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 c1t5006048452A63B16d0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.3 0 0 c1t5006048452A64456d14
0.0 0.6 0.3 3.4 11.8 0.0 20589.8 2.0 98 0 c0t5006048452A64459d9
iostat -x :
extended device statistics
device r/s w/s kr/s kw/s wait actv svc_t %w %b
sd1 0.7 1.9 9.7 14.4 0.0 0.1 21.3 0 1
sd2 0.8 1.9 9.9 14.4 0.0 0.0 16.9 0 1
sd3 0.1 0.7 3.6 4.5 0.0 0.0 20.6 0 0
sd4 0.1 0.6 3.7 4.4 0.0 0.0 16.0 0 0
sd5 0.0 0.0 0.0 0.0 0.0 0.0 0.1 0 0
ssd34 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0
ssd35 0.0 0.0 0.0 0.0 0.0 0.0 0.3 0 0
ssd58 0.0 0.6 0.3 3.4 11.8 0.0 20591.8 98 0
Seconde méthode
Il faut rechercher le device dans /etc/path_to_inst :
grep -w ssd path_to_inst | grep -w <no du ssd>
Le résultat rend une ligne du type : "/pci@1c,600000/lpfc@1/fp@0,0/ssd@w5006048452a64459,9" 58 "ssd"
Ensuite, il suffit de rechercher le lien correspondant dans /dev/dsk pour faire la correspondance avec les target lun cxtyyyyyyydzsn
find /dev/dsk -ls | grep "/pci@1c,600000/lpfc@1/fp@0,0/ssd@w5006048452a64459,9" 374328 1 lrwxrwxrwx 1 root root 67 May 3 2008 /dev/dsk/c0t5006048452A64459d9s0 -> ../../devices/pci@1c,600000/lpfc@1/fp@0,0/ssd@w5006048452a64459,9:a 374329 1 lrwxrwxrwx 1 root root 67 May 3 2008 /dev/dsk/c0t5006048452A64459d9s1 -> ../../devices/pci@1c,600000/lpfc@1/fp@0,0/ssd@w5006048452a64459,9:b 374330 1 lrwxrwxrwx 1 root root 67 May 3 2008 /dev/dsk/c0t5006048452A64459d9s2 -> ../../devices/pci@1c,600000/lpfc@1/fp@0,0/ssd@w5006048452a64459,9:c 374331 1 lrwxrwxrwx 1 root root 67 May 3 2008 /dev/dsk/c0t5006048452A64459d9s3 -> ../../devices/pci@1c,600000/lpfc@1/fp@0,0/ssd@w5006048452a64459,9:d 374332 1 lrwxrwxrwx 1 root root 67 May 3 2008 /dev/dsk/c0t5006048452A64459d9s4 -> ../../devices/pci@1c,600000/lpfc@1/fp@0,0/ssd@w5006048452a64459,9:e 374333 1 lrwxrwxrwx 1 root root 67 May 3 2008 /dev/dsk/c0t5006048452A64459d9s5 -> ../../devices/pci@1c,600000/lpfc@1/fp@0,0/ssd@w5006048452a64459,9:f 374334 1 lrwxrwxrwx 1 root root 67 May 3 2008 /dev/dsk/c0t5006048452A64459d9s6 -> ../../devices/pci@1c,600000/lpfc@1/fp@0,0/ssd@w5006048452a64459,9:g 374335 1 lrwxrwxrwx 1 root root 67 May 3 2008 /dev/dsk/c0t5006048452A64459d9s7 -> ../../devices/pci@1c,600000/lpfc@1/fp@0,0/ssd@w5006048452a64459,9:h
Scripts
Les scripts ont été récupérés sur le site : http://stackoverflow.com/questions/555427/map-sd-sdd-names-to-solaris-disk-names
ksh
for device in /dev/dsk/*s2
do
dpath="$(ls -l $device | nawk '{print $11}')"
dpath="${dpath#*devices/}"
dpath="${dpath%:*}"
iname="$(nawk -v dpath=$dpath '{
if ($0 ~ dpath) {
gsub("\"", "", $3)
print $3 $2
}
}' /etc/path_to_inst)"
echo "$(basename ${device}) = ${iname}"
done
Perl
#!/usr/bin/env perl
use strict;
my @path_to_inst = qx#cat /etc/path_to_inst#;
map {s/"//g} @path_to_inst;
my ($device, $path, @instances);
for my $line (qx#ls -l /dev/dsk/*s2#) {
($device, $path) = (split(/\s+/, $line))[-3, -1];
$path =~ s#.*/devices(.*):c#$1#;
@instances =
map {join("", (split /\s+/)[-1, -2])}
grep {/$path/} @path_to_inst;
*emphasized text*
for my $instance (@instances) {
print "$device $instance\n";
}
}

