Operating System - HP-UX
1752694 Members
5348 Online
108789 Solutions
New Discussion

grep file system percentage above 60 %

 
madhuca-
Occasional Advisor

grep file system percentage above 60 %

Hi

 

I am trying to find the file system percentage which is above 60 %.

 

# bdf | awk -F" " '{ if ($5 > 65) print $5, $6}'| sort -r

 

80% /home
78% /tmp
75% /var/opt/ignite/recovery/archives/prod
71% /var/adm/crash
71% /opt

 

above command is successfull,but there is one more mount point "/var/opt/ignite/recovery/archives/nonprod" which is greater than 65%,but I am not getting the output for  "/var/opt/ignite/recovery/archives/nonprod".

 

my doubt is since it uses same "var/opt/ignite/recovery/archives" I guess above  bdf command is not reporting correct answer that I am expecting.

 

What could be done to fix it.

 

Regards

 

Madhu

 

3 REPLIES 3
Dennis Handly
Acclaimed Contributor

Re: grep file system percentage above 60%

>I am not getting the output for  "/var/opt/ignite/recovery/archives/nonprod".

 

bdf has a "feature" where it splits long lines into two, so unless you make sure that the number of fields is 6, you'll have to read the next line.

 

Or use Bill's bdfmegs:

http://h30499.www3.hp.com/t5/System-Administration/How-to-track-file-system-growth/m-p/6491406#M487106

RenatoMartini
Frequent Advisor

Re: grep file system percentage above 60 %

 

Maybe you limit the output to 5 positions, so the awk filter just shows a limited number of 5 directories, even if the directory "/var/opt/ignite/recovery/archives/nonprod" was greater then 65%, but it is out of range...

 

regards

--Renato Martini (Brazil)
http://renatomartini.net
http://www.iti.gov.br
Bill Hassell
Honored Contributor

Re: grep file system percentage above 60%

bdf is very awkward to use due to split lines.

Here is a function that will always return one line for every mountpoint:

 

function echoBDF1liners
{
 bdf 2>/dev/null | while read FS TOT USED AVAIL PERCENT MNT
 do
    if [ $FS != "Filesystem" ]                       # skip header
    then
       if [ "$TOT" = "" ]                            # check for split lines
       then
          read TOT USED AVAIL PERCENT MNT
       fi
       echo  $FS $TOT $USED $AVAIL $PERCENT $MNT     # single line result
    fi
 done

 return

}

 Just call this function to return bdf output all on one line.

 

 

 



Bill Hassell, sysadmin