Operating System - HP-UX
1748128 Members
3806 Online
108758 Solutions
New Discussion юеВ

Confused about "bdf" command?

 
SOLVED
Go to solution
Worapoj P.
Regular Advisor

Confused about "bdf" command?

Dear all expertise,

I have confused about out put of "bdf" command, please see below

#bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 3145728 2370414 726944 77% /

If calculate by manual
%used = 3145728/2370414 * 100
= 75.35
~ 76%

Why "bdf" command say 77% ??? but exactly ~76%

Thanks advance for you replies
Worapoj P.
For LOVE For Honor For Mankind
2 REPLIES 2
Worapoj P.
Regular Advisor

Re: Confused about "bdf" command?

sorry I missed some one. This is correct message.

Dear all expertise,

I have confused about out put of "bdf" command, please see below

#bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 3145728 2370414 726944 77% /

If calculate by manual
%used = 2370414/3145728 * 100
= 75.35
~ 76%

Why "bdf" command say 77% ??? but exactly ~76%

Thanks advance for you replies
Worapoj P.
For LOVE For Honor For Mankind
Andy Monks
Honored Contributor
Solution

Re: Confused about "bdf" command?

Hi,

The reason is that the 'kbytes' column display, isn't actually what it uses to calculate the percentage from.

If you add together 'avail' and 'used' you will see that it doesn't equal 'kbytes'. This is the overhead of the filesystem structures etc. So, bdf removes that from the calculation.

So, it becomes :-

used / (kbytes - ( free - avail )) * 100 + 0.5

'free' isn't displayed either.

But, it also works with :-

used / ( used + avail ) * 100 + 0.5

or if you want to be really complicated :-

used / ( kbytes + ( kbytes - used - avail ) ) * 100 + 0.5

However, 'free' can be viewed (assuming a vxfs filesystem), using the 'fstyp -v /dev/vgXX/lvolYY' command.

Andy