Operating System - HP-UX
1833016 Members
2742 Online
110048 Solutions
New Discussion

Piece of source code for disk information summary

 
SOLVED
Go to solution
Mihails Nikitins
Super Advisor

Piece of source code for disk information summary

Hi,

Please share piece of source code in Perl or Shell for printing the following information

pvdisplay for all disks
vgdisplay for all disks
lvdisplay for each volume

Many thanks in advance for saving my time!

BR,
Mihails
KISS - Keep It Simple Stupid
1 REPLY 1
Steve Steel
Honored Contributor
Solution

Re: Piece of source code for disk information summary

Hi

This will get you started
I put in line numbers to aid you recomposing it
And uploaded it


1 dlis1=`ioscan -nf|grep /dev/dsk/|sed -e 's:.*/dev/dsk/:/dev/dsk/:'|cut -f1 -d " "`
2 dlis=""
3 for d in $dlis1
4 do
5 dlis=$dlis" "`strings /etc/lvmtab|grep $d`
6 done
7 echo "" > /tmp/filit$PPID
8 for d in $dlis
9 do
10 echo Disc "|"$d"|" >> /tmp/filit$PPID
11 echo "-------------------------------------------------------------------------------" >> /tmp/filit$PPID
12 pvdisplay -v $d 2>&1|grep -v current|
13 grep -v "free " |
14 grep -v "Physical extents"|
15 grep -v "PE Status" >> /tmp/filit$PPID
16 echo " " >> /tmp/filit$PPID
17 echo " ============================ " >> /tmp/filit$PPID
18 done
19 vgs=`grep "VG Name" /tmp/filit$PPID|sed -e 's:.*/dev/::'`
20 echo "||||||||||||||||| VOLUME GROUPS |||||||||||||||||||||||||||||||||||||||||||" >> /tmp/filit$PPID
21 for v in $vgs
22 do
23 echo VG $v >> /tmp/filit$PPID
24 echo "-------------------------------------------------------------------------------" >> /tmp/filit$PPID
25 vgdisplay -v $v 2>&1|grep -v current >> /tmp/filit$PPID
26 echo " " >> /tmp/filit$PPID
27 echo " ============================ " >> /tmp/filit$PPID
28 done
29 lvs=`grep "LV Name" /tmp/filit$PPID|grep dev|sed -e 's:.*/dev:/dev:'|sort -u`
30 echo "||||||||||||||||| LOGICAL VOLUMES ||||||||||||||||||||||||||||||||||||||||||" >> /tmp/filit$PPID
31 for v in $lvs
32 do
33 echo LV $v >> /tmp/filit$PPID
34 echo "-------------------------------------------------------------------------------" >> /tmp/filit$PPID
35 lvdisplay -v $v 2>&1|grep -v current|
36 grep -v "LE PV1"|
37 grep -v "Logical extents" >> /tmp/filit$PPID
38 echo " " >> /tmp/filit$PPID
39 echo " ============================ " >> /tmp/filit$PPID
40 done
41 cat /tmp/filit$PPID|grep -v " 0"
42 rm /tmp/filit$PPID
43 echo ===============================SOFTWARE=========================================
44 swlist -l product|grep -v "#"

Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)