calculating the size of the luns using script

Hi

This is the lspv output of my server :

cbspsdb01 [/] #lspv

hdisk0 00c7518d2d512fd4 cdgvg active
hdisk1 00c7518d2dcbc9d6 cdgvg active
hdisk2 00c7518dcda9199a appvg active
hdisk3 00c7518dcda9388c itcamvg active
hdisk4 00c7518d85724ca6 rootvg active

Can anyone help me to write a script which will sum the size of all the hdisks and give the value ?

The script should give the sum value of (bootinfo -s hdisk0 + bootinfo -s hdisk1 + bootinfo -s hdisk2 + bootinfo -s hdisk3 + bootinfo -s hdisk4) in GigaBytes ?

Try:

lspv | awk '{s="bootinfo -s "$1;s|getline x;sum+=x}END{printf "%.2fGB\n",sum/1024}'
1 Like