On Mon, 22 Oct 2001 at 18:25, Juan Miguel Cacho wrote:
> Or, du does not report superblock usage; it only reports file and
> directory size.

This is correct. du vs df reports WILL differ, and it's not because of
corruption.

du will go through each file and report the contents of that file. A
directory per se does not occupy space as far as du is concerned (although
of course occupies space as far as the filesystem is concerned, and what
takes up this space varies depending on what filesystem you use). Instead
du will go through each file in a directory and return the sum of the file
contents of that directory.

Take this example:

jijo@gusi:~$ du -csb notes
8192    notes
8192    total
jijo@gusi:~$ cd notes
jijo@gusi:~/notes$ mkdir test
cdjijo@gusi:~/notes$ cd ..
jijo@gusi:~$ du -csb notes
8192    notes
8192    total
jijo@gusi:~$ cd notes/test
jijo@gusi:~/notes/test$ mkdir test
jijo@gusi:~/notes/test$ cd ../..
jijo@gusi:~$ du -csb notes
8192    notes
8192    total

Notice how the size of the notes directory did not change as far as du is
concerned. But the two test directories had to take up space, right? Their
names, the date they were created, and the first test's contents had to
take up space. Of course they take up space. Metadata space, that is. And
du does not count metadata.

df, on the other hand, will ask the filesystem about usage. df will
therefore include usage of such things as the superblock, metadata, the
journal, et al. For this reason, as your filesystem varies, so will the
results of df. du, however, should be quite consistent (assuming your data
doesn't change).

SUMMARY:

1. du will be more accurate if you want to know how much data the files
have, and thus the space that data actually occupies.

2. df will be more accurate if you want to know total disk usage of a
particular filesystem, and how much actual disk space is available.

 --> Jijo

PS- note to self: add FAQ entry. ;>

--
Federico Sevilla III  :: [EMAIL PROTECTED]
Network Administrator :: The Leather Collection, Inc.
GnuPG Key: <http://jijo.leathercollection.ph/jijo.gpg>

_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

To subscribe to the Linux Newbies' List: send "subscribe" in the body to 
[EMAIL PROTECTED]

Reply via email to