Operating System - HP-UX
1825759 Members
2188 Online
109687 Solutions
New Discussion

difference between df & bdf commands

 
HP-FMS
Frequent Advisor

difference between df & bdf commands

why system shows diffrence in sizes of a file system by bdf and du command?

Plz reply

Thanks,
Irshad
5 REPLIES 5
Patrick Wallek
Honored Contributor

Re: difference between df & bdf commands

bdf shows KB by default. du shows # of 512-byte sectors by default. If you add the '-k' switch to du, then it will show size in KB.

If that isn't what you are asking, perhaps better stating your question would help.
YAQUB_1
Respected Contributor

Re: difference between df & bdf commands

Hi HP,

>> difference between df & bdf commands

bdf:The bdf command provides a simple tool for determining the amount of file system free space. The bdf output has several fields:
1. Filesystem---(Block device file of the file system)
2. Kbytes---(The number of kilobytes of total disk space on the file system)
3. Used---(The number of kilobytes of disk space used by existing files) etc.

df:When you want to see more details, for example how much space is used beneath a directory, you can do this with the du command. By default, du shows the amount of space in blocks of 512 bytes. It is recursive, meaning that it starts at the current directory (or file specified) and reports on all files and directories from that point on down.
The main options are:
-k Report output in kilobytes.
-s Print only the grand total of disk usage for each of the specified directory operands.

Please assign points, other way nobody can reply Ur question, because every person uses there valuable time for U.

Thanks--Yaqub
HP Support!!!
Hein van den Heuvel
Honored Contributor

Re: difference between df & bdf commands

Irshad,

The subject asks about "df & bdf".
The topic text asks about "bdf and du".

I guess that's the one you really want to understand. Well, that question has been asked and answerred many, many times before.

Most likely cause:
- files which are deleted, but still in open.
Second potential cause:
- sparse files

Oracle TEMP files can represent both.

Please google: hpux du bdf
Toss in a 'sparse' for intersting answers.

hth,
Hein.
Dennis Handly
Acclaimed Contributor

Re: difference between df & bdf commands

Were you asking about du(1) or df(1)?
Both return the output in bogus 512 blocks as Patrick mentioned.
Also du(1) doesn't account for removed but open files. (There are many threads on this.)
Bill Hassell
Honored Contributor

Re: difference between df & bdf commands

Most likely sparse files (very common question). Most databses create only a few parts of data files at semi-random file positions, the rest of the file is left undefined. A sparse file is one that has been created with 'holes' or unwritten parts.

Consider writing a file with record #1, then by seeking to record one million, writing another record and then closing the file. The file has but two records and occupies only a couple of blocks but the missing parts are not stored nor counted in bdf(1) or du(1).

Depending on the size of the file and the spareseness, the difference in apparent versus actual size may be VERY large.

Create your own sparse file with:

dd if=/etc/issue of=/var/tmp/sparse bs=2048k seek=1

where you will see the original file is just a few dozen bytes, the result with ls -l or wc -c shows a 2 meg file, but du(1) will show the file as occupying just a bit more than the original /etc/issue file. A cp(1) of the file will create a new file that is the same size (using ls -l or wc -c) but du(1) will now show a MUCH larger size than the original file.

A common file that is often sparse is a core file from a crashed program. Another file that might be sparse is /etc/mail/aliases.pag. And of course, any programmer could write special code that creates a sparse file. Also note that bdf can take a few seconds to report updated information when a large file is removed.


Bill Hassell, sysadmin