Re: Script to pull out all the LUN/DISK Details (625 Views)
Reply
Regular Advisor
Kennedy G. Doss
Posts: 138
Registered: ‎09-18-2005
Message 1 of 7 (677 Views)
Accepted Solution

Script to pull out all the LUN/DISK Details

SysAdmin Brethren:

 

      Can anyone share a good script to extract information related to all the LUNs on a HP-UX 11.11 Server. The details that I am looking for are LUN IDs, Paths(And Alternate paths - CTD numbers), Assigned/Unassigned to VG, and size of each disk. Any input from you would be most appreciated.

 

    ( I do use emcgrab - which is a very powerful tool which gives me all the information but it is scattered all around a 40-50 page doc with a lot of unnecessary info. And the process is also very long to run and upload the GZ file and extract info.) I need something simpler.

 

Thanks in advance,

-Kennedy

Honored Contributor
Matti_Kurkela
Posts: 6,271
Registered: ‎12-02-2001
Message 2 of 7 (673 Views)

Re: Script to pull out all the LUN/DISK Details

You mentioned "emcgrab" so I guess you might be using EMC storage then?

Here's a bit of "stream-of-consciousness" before I go to sleep...

 

In that case, the "inq" utility might be useful for you. It's free:

ftp://ftp.emc.com/pub/elab/inquiry/

Choose the latest version, then inq.hpux64 for 64-bit PA-RISC systems, or inq.hpux1100 for 32-bit systems.

For Itanium systems, there is inq.HPUXIA64.

 

Download the appropriate binary to your HP-UX system, chmod a+x to mark it executable, remove the suffix if you wish, then run it.

 

It will quickly display the EMC ID numbers for each CTD path: finding the alternate paths is then a matter of locating the paths with the same EMC ID. (Redirect the output to a file, then sort by the EMC ID field and it should be easier.)

The EMC ID may be embedded in the serial number field, depending on the chosen options: with Symmetrix, the first two digits  are the last digits of the serial number of the storage, third is 0, the middle 4 digits are the Symm ID of the LUN, and the last three digits apparently are related to the type of the LUN (Gatekeeper, regular storage, synced to another Symmetrix, etc.)

 

The list of paths assigned to VGs can be retrieved by "strings /etc/lvmtab", however it needs a bit of clean-up. Perhaps using sed to filter out everything that is not a valid cXtYdZ disk path?

 

From these components, it should be possible to construct any kind of disk/LUN listing you may need.

MK
Regular Advisor
Kennedy G. Doss
Posts: 138
Registered: ‎09-18-2005
Message 3 of 7 (653 Views)

Re: Script to pull out all the LUN/DISK Details

Matti:

 

Thanks a billion for taking the time in explaining these. It is very useful information to all of us. I was wondering if I could really lay my hands on a script that can do all these things and give me the outputs in a pleasant format instead of getting several outputs and co-relating stuff. I have managed to get a perl script from a fellow SA like yourself. I am sharing this with the group. Please feel free to make use of it. It lists all the details related to the LUNs and each one of the alternate paths, LUN ID and If the LUN belongs to a VG or not. The only thing I am missing is the size of the LUN. I am not very knowledgeable with pearl scripting. But, if someone can modify I would really appreciate it. I only need the size of the LUN added to the output. (Right now I collect the output and run a diskinfo on each one of them to find the sizes of the LUNs). Here is a sample output:

# ./LUNIDENTIFICATION.pl
NON-ASSIGNED 60060160301B1700245886388ADBDF11 [LUN 98] -> c12t1d4 c14t1d4 c18t1d4 c25t1d4
ASSIGNED     600601601F131100B8C06E33E0A6DE11 [LUN 32] -> c12t1d0 c14t1d0 c18t1d0 c25t1d0
ASSIGNED     60060160301B17005C547BCFB0DBDF11 [LUN 41] -> c12t1d7 c14t1d7 c18t1d7 c25t1d7
ASSIGNED     600601601F131100FECAFB0726EBD811 [LUN 20] -> c12t0d1 c14t0d1 c18t0d1 c25t0d1
ASSIGNED     6000144000000010A002304E0EA5271A -> c28t1d6 c30t1d6 c32t1d6 c34t1d6

 

Acclaimed Contributor
James R. Ferguson
Posts: 21,184
Registered: ‎07-06-2000
Message 4 of 7 (641 Views)

Re: Script to pull out all the LUN/DISK Details

Hi:

 

You could modify the last 'foreach' loop to look something like this:

 

foreach my $lun (keys %luns) {
  if ($luns_assigned{$lun}){
     print "ASSIGNED     ";
  } else {
     print "NON-ASSIGNED ";
  }
  print "$lun -> $luns{$lun}\n";

  #...begin new code...
  my @sizeof = split / /, $luns{$lun};
  for my $device (@sizeof) {
      my $info = `diskinfo /dev/rdsk/$device`;
      print $device, q( = ), $1 if $info =~ m{size:\s+(\d+)};
      print "\n";
  }
  #...endof new code...
}

Regards!

 

...JRF...

Regular Advisor
Kennedy G. Doss
Posts: 138
Registered: ‎09-18-2005
Message 5 of 7 (632 Views)

Re: Script to pull out all the LUN/DISK Details

James:

 

This is exactly what I was looking for. Thanks a billion. I owe you one!!! Thanks again. It works like a charm.

Acclaimed Contributor
James R. Ferguson
Posts: 21,184
Registered: ‎07-06-2000
Message 6 of 7 (628 Views)

Re: Script to pull out all the LUN/DISK Details


Kennedy G. Doss wrote:

James:

 

This is exactly what I was looking for. Thanks a billion. I owe you one!!! Thanks again. It works like a charm.


If you are happy with the answers you received, click the Kudos star next to the post(s) that helped and  mark the post that actually provided the best solution as solved.  These are two separate actions.

 

Regards!

 

...JRF...

Regular Advisor
Kennedy G. Doss
Posts: 138
Registered: ‎09-18-2005
Message 7 of 7 (625 Views)

Re: Script to pull out all the LUN/DISK Details

Done!

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.