Re: [Hampshire] Baffled by df/du

Top Page

Reply to this message
Author: Daniel Pope
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Baffled by df/du
Jim Kissel wrote:
>
> Just done a clean minimum install of Debian Etch under VMWare
> Workstation 5.5 and I find df reporting:
> Filesystem           1K-blocks     Used Available  Use% Mounted on
> /dev/hda1              1359816   287656  1992884    23% /
> udev                     10248       56    10184     1% /dev
> devshm                  128588        0   128588     0% /dev/shm
> /dev/hda6              2601116    69516  2399469     3% /home

>
> du -s /home reports
> 40 /home
>
>
> du's 40 used blocks != 69516 Used in df
> I know there is a simple explanation, but what is it?


du only reports blocks allocated to files and directories. df reports all block
usage, including inode and superblocks. On ext2/3, these are allocated when the
filesystem is formatted.

du and df should not be expected to match on any filesystem. du computes a
userspace guesstimate of the disk use. df is the FS driver reporting statistics
about how much space is unallocated, which is accurate only with an
understanding of driver internals and should otherwise be considered another
(different) estimate.

Dan