Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Disk Names - sdXX vs. cXtXdXsX

RE: Disk Names - sdXX vs. cXtXdXsX

From: Lord, David - C&S <David.Lord_at_hayscsg.com>
Date: Fri, 17 Aug 2001 00:31:42 -0700
Message-ID: <F001.0036E6CE.20010817002520@fatcity.com>

> Is there a method or utility to translate disk names
> reported by sar from the sdXX format to the cXtXdX
> format? I'm on a Sun platform.

If you look in /dev there are links from sd* to dsk/c*t*d*s*. I've got a little perl script to do the translation (see below), but its a bit rough-and-ready.

HTH
David Lord

X--------------------------------------------------------------------X
#!/usr/local/bin/perl -w
use strict;

my $opt;
my $opts = '';
while( $opt = shift ) {

        $opts .= ' '.$opt;
}

my %devs;
my %fs;
my $line;
my ($device, $busy, $avque, $rws, $blks, $avwait, $avserv);

for ( `cat /etc/vfstab` ) {
  chomp;
  next if /^\s*\#/;
  my @vfstab = split /\s+/;
  $vfstab[0] =~ s/^.*\/([^\/]*)$/$1/;
  $fs{$vfstab[0]} = $vfstab[2];
}

for ( `ls -l /dev/sd*` ) {

        /\/dev\/sd([0-9]+)([a-z]?).*dsk\/(\S+)/;   my $num = $1;
  if( $num == 0 ) { $num = 3 }
  elsif( $num == 3 ) { $num = 0 }
  my $letter = $2;
  my $dsk = $3;
  $devs{ 'sd'.$num.','.$letter } = $dsk;   ($devs{ 'sd'.$num } = $dsk) =~ s/s[0-9]+//; }

print "sar -d ".$opts."\n";
open( SAR, "sar -d $opts|" ) or die( "Cannot open pipe to sar" );

format STDOUT_TOP =

device                     %busy   avque  r+w/s blks/s avwait avserv
-------------------------- ------ ------ ------ ------ ------ ------
.

format STDOUT =

@<<<<<<<<<<<<<<<<<<<<<<<<< @##### @###.# @##### @##### @###.# @###.#
$device,$busy,$avque,$rws,$blks,$avwait,$avserv .

while( <SAR> ) {
  chomp;
  if( /^Average/ ) {
    s/Average/ /;
    s/^\s*//;
    ($device, $busy, $avque, $rws, $blks, $avwait, $avserv) = split /\s+/;     $device = $devs{$device} if defined $devs{$device};     if( defined $fs{$device} ) { $device .= ' ('.$fs{$device}.')' } # print $device,' ',$busy,' ',$avque,' ',$rws,' ',$blks,' ',$avwait,' ',$avserv,"\n";

    write;
    while( <SAR> ) {

      chomp;
      s/^\s*//;
      ($device, $busy, $avque, $rws, $blks, $avwait, $avserv) = split /\s+/;
      $device = $devs{$device} if defined $devs{$device};
      if( defined $fs{$device} ) { $device .= ' ('.$fs{$device}.')' }
#      print $device,' ',$busy,' ',$avque,' ',$rws,' ',$blks,' ',$avwait,'
',$avserv,"\n";
      write;

    }
  }
}
X--------------------------------------------------------------------X
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Lord, David - C&S
  INET: David.Lord_at_hayscsg.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Fri Aug 17 2001 - 02:31:42 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US