Re: df and du don't seem to agree ?
Hi
On Tue, Aug 21, 2012 at 03:45:35PM +0100, David Cho-Lerat wrote:
> Hi list,
>
> this might be a newbie question, but can anyone tell me
> why "du" and "df" don't seem to agree :
>
> server:~# df -h /var
> Filesystem Size Used Avail Use% Mounted on
> /dev/mapper/vg00-var 5.0G 4.1G 624M 87% /var
> server:~# du -h -s /var
> 1.6G /var
>
> ("/var" is on a partition of its own.)
FYI: I always use the "-x" flag on du too, as this will not recurse down
other mounted file systems - e.g. if you have /var/cache on a separate
logical volume.
> "du" says 1.6G are used, while "df" reports 4.1G. Any idea why ?
"du" will only be reporting disk usage by files and directories it can
find. It will not report overhead by the filesystem itself.
In your case, the discrepancy is too big (1.6G vs 4.1G) to be
explained by this...
A couple of possibilities:
- Deleted files which are open: When a file is deleted, the space is
usually freed immediately. UNLESS the file is open, in which case
the space will not be freed until whatever-has-it-open closes it.
- Other mountpoints: If you have lots of files in a subdirectory
(e.g. /var/cache) and then mount another file system on /var/cache,
you cannot reach the original contents of /var/cache - and this will
then be invisible to "du"...
>
> I know some amount of space is supposed to be "reserved for the
> super-user", but that's typically around 5%, right ?
Around that percentage, yes. But neither du nor df takes this into
account.
> By the way, is there a command to see how big this reserved space
> actually is on a given partition/disk ?
in your case:
lvdisplay vg00/var
as you have a logical volume mounted on /var.
Hope this helps
--
Karl E. Jorgensen
Reply to: