1833871 Members
1773 Online
110063 Solutions
New Discussion

Re: bdf and df outputs

 
SOLVED
Go to solution
SSP_1
Regular Advisor

bdf and df outputs

Hello Experts,

I am getting a huge difference when trying to figure the filesystem space using bdf and df -k commands. Can anyone pl explain why there is such discripency if both the commands gives disk space. Attached are the outputs of both the commands.

$ bdf /data/PPT01A/u01
Filesystem kbytes used avail /dev/vgp_ern_d4/lvol_test_db01
5242880 2385 4912972 0% /data/PPT01A/u01
$ df -k /data/PPT01A/u01
/data/PPT01A/u01 (/dev/vgp_ern_d4/lvol_test_db01) : 4915357 total allocated Kb 4912972 free allocated Kb
2385 used allocated Kb
0 % allocation used
Obstacles exist to challenge you to keep going. Not to quit.
5 REPLIES 5
Stefan Farrelly
Honored Contributor

Re: bdf and df outputs


bdf usually updates irregularly and isnt so accurate. To make it a bit more accurate do;

sync;sync;sync;bdf

This will flush the buffer cache and update bdf. But you will still probably see discrepencies between bdf and df as they calculate totals differently, and are subject to things like files being open and still written to.
The most accurate tool to use is du, ie. du -sk / as this will actually go and count all the files and dirs and give you a total.
Im from Palmerston North, New Zealand, but somehow ended up in London...
V.Tamilvanan
Honored Contributor

Re: bdf and df outputs

Hi,
If your FS is HFS. Default 10% of the total size will be used for recover purpose. It won't be calculate in df -k.
See man tunefs.
If the discrepancy is so big there may be a process running on the FS but actually the file is explicitely removed. Once u reboot or kill the process u will be getting the proper info.

HTH
Armin Feller
Honored Contributor
Solution

Re: bdf and df outputs

Obviously there is a difference how du and bdf count. This may occur if we touch open files.

"du" offers in a way a positive view: it shows the number of currently allocated blocks and counts the blocks you've just deleted as free.

"bdf" has a more negative perspective: it shows the free disk space available.

The difference is here: if a still active process allocated blocks eg for a logfile that you've just deleted "bdf" counts these as still occupied. This wont change until the process closes the file ("deallocates the blocks") as it usually happens when the process terminates.


Regards...
Armin
V.Tamilvanan
Honored Contributor

Re: bdf and df outputs

Hi,
According to your output. I am sure the discrepancy is due to the default minfree 10% of your HFS FS.
There won't be any much discrepancy between bdf and df if it is a VXFS FS.

If u use
#tunefs -v /data/PPT01A/u01
It will show all the FS parameters.

You can reduce the 10 % to till 0 by

#tunefs -m
This can be done when FS is mounted nothing will happen to your data but u get a free space for your normal use.

Note: A huge difference between bdf and du comes only when some process writes to a file and that file has been deleted. The difference won't come between bdf and df -k which is your case.

HTH
Pete Randall
Outstanding Contributor

Re: bdf and df outputs

Who said anything about du? The question was about bdf and *df*!!!


Pete

Pete