LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   varied output for linux df and du commands on same file system (https://www.linuxquestions.org/questions/linux-newbie-8/varied-output-for-linux-df-and-du-commands-on-same-file-system-606004/)

bzlaskar 12-11-2007 05:38 AM

varied output for linux df and du commands on same file system
 
Greetings,

When I run df -h /var , it displays the disk usage as

$ df -h /var/

Filesystem Size Used Avail Use% Mounted on
/dev/sda9 4.8G 3.3G 1.3G 73% /var

But when I run the du -sh for the same file system , the result
varies .

du -sh /var/
3.2G /var/

What is the reason for the difference in results .......

With Thanks in Advance
zaman

pixellany 12-11-2007 10:41 PM

"df" gives you the total space used on a partition

"du" gives you the space used by certain files/directories.

I assume that there is some overhead which would cause df to report higher numbers. You might want to try some experiments with--eg--the "-B" option to specify the block size. There may also be some rounding---eg the real numbers could be 3.249 (3.2) and 3.251 (3.3)


All times are GMT -5. The time now is 07:06 AM.