Operating System - HP-UX
1833907 Members
2016 Online
110063 Solutions
New Discussion

disks to filesystem co-relation

 
FNU Kennedy_2
Occasional Contributor

disks to filesystem co-relation

Group:

I need a script which would help me to co-relate a disk to its filesystem. (if not logical volume atleast). I get performance monitoring reports for 400 odd disks everyday which are hitting a limit and when I send the reports my users want it to in the form of filesyste. (That is a legitimate request from them). Can someone help me by giving ideas or if there is a ready made one already could you please point me to one.? Thanks in advance.

Kennedy
4 REPLIES 4
Todd McDaniel_1
Honored Contributor

Re: disks to filesystem co-relation

here is a small script that shows disk by VG you can modify it to show by LVOL and FS.

# cat vglist.sh
for name in `cat /root/vgnamesEMC.out `
do
echo $name
vgdisplay -v $name |grep "PV Name" |awk '{ print $3 }'
done > /root/disks.by.VG.`date +%m%d%y` 2> /root/vgerr.`
date +%m%d%y`


Must have a control file with the VGs listed called vgnamesEMC.out.
Unix, the other white meat.
John Kittel
Trusted Contributor

Re: disks to filesystem co-relation

what kind of performance report?

if it were for example freespace, used space, etc. - wouldn't it be more natural to start with filesystem and just report that? Since disks can be mirrored, raided, grouped into volume groups, filsystems spread out over several physical disks, single disks with multiple filesystems on them, etc, it seems to me it could be very difficult to start with disk and try to "correlate to filesystem", whatever that would mean.
Sridhar Bhaskarla
Honored Contributor

Re: disks to filesystem co-relation

Hi Kennedy,

This is a small script that I use it on the fly

for PV in $(vgdisplay -v |grep -v Alternate|awk '/PV Name/ {print $3}')
do
LVs=$(pvdisplay -v $PV |printf "%s," $(awk '/current/ {print $3}' |sort|uniq))
LVs=$(echo $LVs|sed 's/,$//g')
echo $PV:$LVs
done

May give out errors if there is a problem with the VGs but should produce the output you need.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Sundar_7
Honored Contributor

Re: disks to filesystem co-relation

You can try something like this

for DISK in $(cat /tmp/400-odd-disksreport)
do
LVS=$(pvdisplay -v $DISK | grep "^ */dev/vg" | awk '{print $1}')
echo "$DISK"
echo "$LVS" | xargs -i echo "\t{}"
done

The above loop will display the list of logical volumes that the disk contains.

But remember, a logical volume can span multiple disks.

for DISK in $(cat /tmp/400-odd-disksreport)
do
LVS=$(pvdisplay -v $DISK | grep "^ */dev/vg" | awk '{print $1}')
echo "$DISK"
echo "$LVS" | xargs -n1 bdf
done

The above script excerpt will tell you the filesystems that are on the disk.

-- Sundar
Learn What to do ,How to do and more importantly When to do ?