Operating System - HP-UX
1745793 Members
3940 Online
108722 Solutions
New Discussion

Re: Device Name -VG -LV -Mount point

 
SOLVED
Go to solution
Ajin_1
Valued Contributor

Device Name -VG -LV -Mount point

Hi Experts

 

 

Hp ux Server having Multiple device files for disks .

 

Any specific Script to get output of device file using concern VG -LV -Mount Point.

 

Regards

 

Ajin.S

Thanks & Regards
Ajin.S
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
4 REPLIES 4
Modris Bremze
Esteemed Contributor

Re: Device Name -VG -LV -Mount point

vgdisplay -v vgname

Ajin_1
Valued Contributor

Re: Device Name -VG -LV -Mount point

Hi

 

vgdisplay -v vgname not display the mount point belong to the VG.

 

I have more than 10000 device files configured in LVM in my Server .My requrement was i want to know which device file bloong to which VG  and LV and the corresponding Mount Point.

 

Same like SAR report output with Mount Point details.

Thanks & Regards
Ajin.S
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Bill Hassell
Honored Contributor
Solution

Re: Device Name -VG -LV -Mount point

This code will display each mountpoint, the VG, the LV and the PVs that are part of the LV.

It is sorted by VG/LV. If there are multiple PVs that are part of the LV, all the PVs are on the same line.

 

bdf -l |
   grep -v ^Filesystem |
   while read LV KB USED AV PCT MNT
do
   [[ "$KB" = "" ]] && read KB USED AV PCT MNT
   PV=$(lvdisplay -v $LV |
      awk '/--- Dist/,/--- Logi/' |
      awk '/\/dev\/d/{print $1}')
   VG=$(echo $LV | cut -f3 -d/)
   LVOL=$(echo $LV | awk -F / '{print $NF}')
   echo $MNT  $VG $LVOL $PV
done | sort -k2

 



Bill Hassell, sysadmin
Dennis Handly
Acclaimed Contributor

Re: Device Name -VG -LV -Mount point

You can remove one of the awks by:

   PV=$(lvdisplay -v $LV |

      awk '/--- Distribution/,/--- Logical/ {
         if ($1 ~ "/dev/d") { print $1; exit }
      }' )