Mailinglist Archive: opensuse (1445 mails)

< Previous Next >
[opensuse] Re: faster way to get total dir size besides du?
  • From: Jim Henderson <hendersj@xxxxxxxxx>
  • Date: Tue, 6 Mar 2012 04:40:45 +0000 (UTC)
  • Message-id: <jj44gd$dlq$>
On Tue, 06 Mar 2012 04:38:21 +0100, Carlos E. R. wrote:

Hash: SHA1

On 2012-03-06 04:07, David Haller wrote:

- AFAIK no filesystem I know of stores the sizes of a directory's
contents somewhere in the directory's metadata

FAT does, kind of. The directory is a record that contains file names,
attributes, sizes, and starting record. You just have to load the
directory record and sum the sizes of all files: one single read one
disc record operation (I don't remember how many files per record). If
the directory is big, then there have to be more reads. The operation is
very fast. If there are subdirectories, then it is slower (recursive

That's different than storing the size of the contents in the directory
entry's metadata - the summing of each subordinate file is what takes the
time. What David is trying to say is that no filesystem that he knows of
(nor that I know of for that matter) stores the total of the subordinate

ie, for a structure of:


/usr doesn't store the sum of the sizes of file1, file2, and file3. It
has to be calculated on the fly.


Jim Henderson
Please keep on-topic replies on the list so everyone benefits

To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups