![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Dig command output? | sujathab | UNIX for Dummies Questions & Answers | 1 | 01-21-2008 06:54 AM |
| output of who command | sanjaykhuntia | Linux | 1 | 10-31-2007 05:35 AM |
| if command not having the right output | filthymonk | Shell Programming and Scripting | 9 | 05-22-2007 10:11 PM |
| Output of ps -ef command | dbrundrett | UNIX for Advanced & Expert Users | 6 | 01-06-2005 11:48 AM |
| Output command | berty007 | Shell Programming and Scripting | 4 | 11-29-2002 02:27 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Why command df and du reports different output?
There a mismatch between df and du outputs
Both df and du reporting different output. It is confusing. the answer that I get is that Open file descriptor is main causes of such wrong information. For example if file is open by third party application OR by a user and same file is deleted, both df and du reports different output. Is any way to fix/bypass this ? p.s Usually this scenario is happening on Linux RH |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Its like that
The df, du, and ls commands have a new h option for displaying disk usage and file or file system sizes that are easy to understand. The default form of the df command displays file system size in blocks (512 bytes). The df output, in kilobytes, follows: $ df -k / /usr Filesystem kbytes used avail capacity Mounted on /dev/dsk/c0t0d0s0 192056 94788 78063 55% / /dev/dsk/c0t0d0s6 1982988 829966 1093533 44% /usr The same file system sizes displayed in powers of 1024 follows: $ df -h / /usr Filesystem size used avail capacity Mounted on /dev/dsk/c0t0d0s0 188M 93M 76M 55% / /dev/dsk/c0t0d0s6 1.9G 811M 1.0G 44% /usr The default form of the du command displays disk space in blocks (512 bytes). The du output, in blocks, follows: % du -s k* 100 kadmin 98 kadmin.local 98 kdb5_util 90 keyserv 10 killall The same disk space displayed in powers of 1024 follows: % du -h k* 50K kadmin 49K kadmin.local 49K kdb5_util 45K keyserv 5K killall The default form of the ls -l command displays file size in bytes. Use the ls -lh command to display file size in powers of 1024: % ls -lh k -r-xr-xr-x 1 root bin 49K Nov 30 03:32 kadmin -r-xr-xr-x 1 root bin 49K Nov 30 03:32 kadmin.local -r-xr-xr-x 1 root bin 49K Nov 30 03:32 kdb5_util -r-xr-xr-x 1 root sys 44K Nov 25 04:37 keyserv -r-xr-xr-x 1 root bin 4.3K Nov 25 04:36 killall |
|
#3
|
|||
|
|||
|
this is not the differences that I meant.
I mean that in df -h I see usage of 100G and in du -h I see only 1M ... |
|
#4
|
||||
|
||||
|
du and df are fundamentally different. df reports on a filesystem as a whole, while du reports on individual files. Yes, du cannot see deleted files that are still open. Mostly, those are caused by folks who use the rm command without thinking. The space will be freed when the process exits and a reboot will kill all processes. So a reboot will tend to equalize usage reported by the commands and not rm'ing open files will help stop it from happening in the first place. But not all filesystem space is devoted to files. There is meta-data too...inodes, cylinder groups, super blocks, etc. They will never be the same...and if they were, what would be the point of a duplicate command?
|
||||
| Google The UNIX and Linux Forums |