- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script to identify alternate PV links
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-16-2010 05:12 AM
тАО06-16-2010 05:12 AM
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-16-2010 05:39 AM
тАО06-16-2010 05:39 AM
Re: Script to identify alternate PV links
Using:
# vgdisplay -v
...will show alternate links under the "Physical volumes" stanza.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-16-2010 06:01 AM
тАО06-16-2010 06:01 AM
Re: Script to identify alternate PV links
Thanks for that.. But I need some thing more than that.. I am in the process of documenting the hardware configuration/usage of a number of servers. As a part of it I need the number of disks and the alternate PV links to each disks on a given server.So I am looking for a script/one liner which I can execute and collect the data with out looking in to the VG configuration.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-16-2010 06:18 AM
тАО06-16-2010 06:18 AM
SolutionI have a few EMC centric scripts that might help.
Some modification is required.
bdf | awk -F\/ '{print $3}' | sort -u | while read -r dv
do
echo "VG:${dv}"
vgdisplay -v $dv | grep "PV Name" | grep -v "Alternate Link"| awk -F\/ '{print
$4}' | while read -r dn
do
diskdev=$(grep $dn /tmp/inq.txt | awk -F\/ '{print $4}');
emcdev=$(grep $dn /tmp/inq.txt | awk -F: '{print $5}');
emcsize=$(grep $dn /tmp/inq.txt | awk -F: '{print $6}');
done
echo "Device: ${diskdev} EMCdev: ${emcdev} EMCSIZE: ${emcsize}"
done
#!/bin/ksh
ITF="interim.disk.list.data"
cp diskrep.txt ${ITF}
bdf | awk '{print $1}' | awk -F\/ '{print $3}' | sort -u | grep -v "^$" | while read -r vg
do
echo ${vg}
vgdisplay -v $vg | awk '/PV Name/' | grep -v "Alternate Link" | awk '{print $3}' | while read -r dn
do
echo "disk: ${dn}"
p1="dev"
p3=$(echo $dn | awk -F\/ '{print $4}')
p2="rdsk"
dinfostring="/${p1}/${p2}/${p3}"
dsize=$(diskinfo ${dinfostring}| grep "size:" | awk '{print $2}')
symid=$(grep ${dinfostring} /tmp/inq.txt | awk -F: '{print $5}')
echo "source: ${dinfostring} size: $dsize (kb) symid: $symid"
# get the destination disk by size create interim file
# 1 get sim id and device of a disk of the same size from the file
# echo "About to grep dsize: ${dsize}"
DL=$(grep ${dsize} ${ITF} | head -1)
# echo "data line is: ${DL}"
if [ "$DL" = "" ]
then
print No Match Found for disk ${dn}
continue
fi
dsimid=$(echo $DL | awk '{ print $5}')
dsdisk=$(echo $DL | awk '{ print $1}')
echo "dest: ${dsdisk} id: ${dsimid}"
grep -v $dsimid ${ITF} > tfile
cp tfile ${ITF}
done
done
This last one is really good and can actually extend your volume group to include alternate links.
None of these scripts are good enough for my blog yet, and they are sadly going to need modification to work with systems that do not have the EMC inq utility.
#!/bin/ksh
inq > /tmp/inq.out
LF="log.txt"
vgname=$1
# vgdisplay -v $vgname | awk -F/ '!/Alternate/ && /PV Name/ {print }'
vgdisplay -v $vgname | awk -F/ '!/Alternate/ && /PV Name/ {print $4}' | while read dname
do
# awk -F: '/\/dev\/rdsk\/'$dname'/ {print }'
sid=$(awk -F: '/\/dev\/rdsk\/'$dname'/ {print $5}' /tmp/inq.out )
echo "sid is ${sid} dname is ${dname}"
# for newdsk in $(awk -F: '{if($5 == "'${sid}'") {print $1} }' /tmp/inq.out | sed 's/rdsk/dsk/g')
# awk -v dsid=${sid} -F: '/'$sid'/ {print}' /tmp/inq.out
# grep ${sid} /tmp/inq.out | awk -F: '{print "vgextend vg08 ",$1}' | sed 's/rdsk/dsk/g'
VGI="/tmp/${vgname}.dat"
vgdisplay -v ${vgname} | awk '/PV Name/ {print $3}' > ${VGI}
for newdsk in $(grep ${sid} /tmp/inq.out |awk '{print $1}' | sed 's/rdsk/dsk/g')
do
# see if disk is present before running vgexend.
present=$(grep ${newdsk} ${VGI} | wc -l)
print vgextend ${vgname} ${newdsk} present: $present
if [ $present -eq 1 ]
then
echo "Disk $newdsk present in $vgname doing nothing"
else
echo "Disk $newdsk NOT present in $vgname extending volume group"
vgreduce -l $vgname $newdsk
vgextend $vgname $newdsk
fi
# echo $newdisk >> $LF
done
done
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-17-2010 02:18 AM
тАО06-17-2010 02:18 AM
Re: Script to identify alternate PV links
Thank you very much for the scripts. I am yet to try these. I do have servers with inq utility installed on them. I believe this will save a lot of time for me. Thanks again
Note: I am not closing this thread now..Anybody who have better suggestions please post :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-17-2010 02:24 AM
тАО06-17-2010 02:24 AM
Re: Script to identify alternate PV links
If you have "symcli" (emc):
# symvg list -v|more
Volume Group Name : /dev/vgxxxxx
Volume Group Type : HP-UX LVM
Volume Group State : Enabled
Volume Group Attributes : Multipathed devices
Group's Physical Extent Size : 4096k
Max Number of Devices in Group : 32
Max Number of Volumes in Group : 255
Number of Devices in Group : 4
Number of Volumes in Group : 26
Physical Device Members (4):
{
-------------------------------------------------------
Cap
PdevName Array Dev Att. Sts (MB)
-------------------------------------------------------
/dev/rdsk/c34t1d2 02627 06E5 (S) RW 8632
/dev/rdsk/c34t1d3 02627 06E6 (S) RW 8632
/dev/rdsk/c34t1d4 02627 06E7 (S) RW 8632
/dev/rdsk/c34t1d5 02627 06E8 (S) RW 8632
}
rgs,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-17-2010 02:29 AM
тАО06-17-2010 02:29 AM