Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

du -sg . 2

Status
Not open for further replies.

gatetec

MIS
Mar 22, 2007
420
US
I need to know the total size of alloted size (not actually used size) of all vgs and files an AIX node?

What is the command that gives you the total alloted size (sum of Total PP Size)?
Would ' du -sg . ' work?

thx much
 
du will only display the used space

try lsvg | grep "USED" on each of your VGs
 
Code:
lsvg -o|lsvg -i|awk '
/GROUP/{vg=$3}
/USED/{groups++;
       mb=substr($6,2);
       totmb+=mb;
       print vg ": " mb "MB used"}
END{print "Total " groups " VGs: " totmb "MB used"}'


HTH,

p5wizard
 
This script works super. How do you modify your script to pul out the TOTAL PPs?

thx much

VG STATE: active PP SIZE: 32 megabyte(s)
VG PERMISSION: read/write TOTAL PPs: 4198 (134336 megaby
tes)
MAX LVs: 512 FREE PPs: 446 (14272 megabyte
s)
LVs: 331 USED PPs: 3752 (120064 megaby
tes)
 
Have a guess... the string between / chars is the search string, then count which field has the free megabytes. Then adapt the program and text that it prints.


HTH,

p5wizard
 
You could also try this handy one liner

print "$(lsvg -Lo |xargs lsvg -L|grep "TOTAL PPs"|awk -F"(" '{print$2}'|sed -e "s/)//g" -e "s/megabytes/+/g"|xargs|sed -e "s/^/(/g" -e "s/+$/)\/1000/g"|bc ) GB"

Change the TOTAL PPs to FREE or USED

Mike

"Whenever I dwell for any length of time on my own shortcomings, they gradually begin to seem mild, harmless, rather engaging little things, not at all like the staring defects in other people's characters."
 
>> count which field has the free megabytes.

I thought these would work, but it is not. Which number should I change to?

lsvg -o|lsvg -i|awk '
/GROUP/{vg=$3}
/TOTAL/{groups++;
mb=substr($6,2);
totmb+=mb;
print vg ": " mb "MB allocated"}
END{print "Total " groups " VGs: " totmb "MB allocated"}'

lsvg -o|lsvg -i|awk '
/GROUP/{vg=$3}
/FREE/{groups++;
mb=substr($6,2);
totmb+=mb;
print vg ": " mb "MB unused"}
END{print "Total " groups " VGs: " totmb "MB unused"}'

thx much
 
print "$(lsvg -Lo |xargs lsvg -L|grep "TOTAL PPs"|awk -F"(" '{print$2}'|sed -e "s/)//g" -e "s/megabytes/+/g"|xargs|sed -e "s/^/(/g" -e "s/+$/)\/1000/g"|bc ) GB"

This works well for the total sum.

thx so much!!
 
MAX LVs: 512 FREE PPs: 446 (14272 megabytes)
$1=MAX
$2=LVs:
$3=512
$4=FREE
$5=PPs:
$6=446
$7=(14272 <====found it!!!!
$8=megabytes)

[tt]lsvg -o|lsvg -i|awk '
/GROUP/{vg=$3}
/FREE/{groups++;
mb=substr([red]$7[/red],2);
totmb+=mb;
print vg ": " mb "MB unused"}
END{print "Total " groups " VGs: " totmb "MB unused"}'[/tt]


HTH,

p5wizard
 
I see!

For TOTAL,

Shouldn't it be ($7,2)?
VG PERMISSION: read/write TOTAL PPs: 4198 (134336 megab)

If I try ($7,2), it give me two lines per vg i.e.

rootvg: 43360MB allocated
rootvg: MB allocated

lsvg -o|lsvg -i|awk '
/GROUP/{vg=$3}
/TOTAL/{groups++;
mb=substr($7,2);
totmb+=mb;
print vg ": " mb "MB allocated"}
END{print "Total " groups " VGs: " totmb "MB allocated"}'

thx much
 
No, you need to adapt the search string: look for /TOTAL PPs/ instead of just /TOTAL/, because there's another TOTAL (PVs) line in the lsvg output... (compare it to the grep in Mike's oneliner)

You're getting there!


HTH,

p5wizard
 
ok, I got it. Works great!!
Thanks so mcuh for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top