[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: df and du disagree



Quoting Patrick Kirk (patrick@kirks.net):
> 
> df shows my main partiton to have 1.1 Gigs of data
> and du -x shows it to have about 650 MB.
> 
> I think du is correct.

I don't. You could try out filling it up as long as you do it as a user,
so that you leave the 5% to prevent the system crashing.

> df reads
> 
> Filesystem            Size  Used Avail Use% Mounted on
> /dev/hda1             1.9G  1.1G  750M  60% /
> /dev/hda3              15M  1.2M   13M   8% /boot
> /dev/hda5             1.7G  1.2G  471M  72% /home
> /dev/hda10            387M  281M   86M  77% /var
> /dev/hda6             3.2G  2.6G  479M  85% /samba

Far from being a duplicate of the previous posting, quite a lot
seems to have changed. You seem to have added 400MB to /,
mounted different partitions and changed your mount points.

I run slink and have just checked that du (as root) and df agree on
Used precisely where expected (i.e. on static partitions like /usr)
and extremely closely where expected (i.e. on /, and my combined /home
/var /tmp partition).

I agree with Eric - that with the confused layout, you've covered
over a bunch of files which will be revealed if you unmount the
partitions in the correct order.

Bear in mind that du can also seriously underreport usage when run
as a user because of permissions (whereas df is always right).

But can I make a couple of suggestions:

1) Would it be simpler to mount all your partitions onto their
own mount points at top level with fixed neutral names. Then
create the directory tree you want with symlinks.

As well as making it simpler to understand what's going on, it means
you can mount partitions in any order as the mount points always
exist. You just have broken symlinks for a few moments during the
mounting process if you mount them in the "wrong" order.
The broken symlinks make it much harder to write files which get
covered up when you mount the next partition.

For example, if I unmount my shared partition called foo on host foo,
then /home becomes a broken link to foo/home and I can't accidently
write files to the empty mount point. I'd have to write to /foo
(the mount point), and the neutral name is a protection.

2) Repost after your partitions have "settled in". It's frustrating
for us to sit here contemplating your first query (which was to do
with hda4) and then suddenly have the query re-posed with a new
set of partitions (a root partition even fuller (it was already
quote "overstuffed") and no hda4).

Cheers,

-- 
Email:  d.wright@open.ac.uk   Tel: +44 1908 653 739  Fax: +44 1908 655 151
Snail:  David Wright, Earth Science Dept., Milton Keynes, England, MK7 6AA
Disclaimer:   These addresses are only for reaching me, and do not signify
official stationery. Views expressed here are either my own or plagiarised.
Contents may settle during transportation.  No artificial sweeteners added.


Reply to: