Mailinglist Archive: opensuse (3337 mails)

< Previous Next >
Re: [SLE] df and du reporting incorrect file sizes
  • From: Jerry Feldman <gaf@xxxxxxx>
  • Date: Wed, 26 Apr 2006 14:14:36 -0400
  • Message-id: <200604261414.37088.gaf@xxxxxxx>
On Wednesday 26 April 2006 12:42 pm, James Watkins wrote:
> Hi all, has anyone seen this before? I'm using an opensuse 10.0 box as a
> samba file server to store backups of our other windows servers. It took
> a while to figure out that there was no disk space since the samba box
> was still reporting that there was plenty. Looking a bit deeper, I found
> that although 'ls -l' showed the sizes of the individual files correctly,
> the total was wildly incorrect. Here is an example of the output of 'ls
> -l' :
>
> total 29274510
> -rwxr--r-- 1 M2\backup M2\domain admins 28353837056 2006-02-18 00:47
> B2D000161.bkf -rwxr--r-- 1 M2\backup M2\domain admins 28456399872
> 2006-04-01 00:51 B2D000162.bkf -rwxr--r-- 1 M2\backup M2\domain admins
> 28456552448 2006-04-04 00:51 B2D000163.bkf -rwxr--r-- 1 M2\backup
> M2\domain admins 28456648704 2006-04-05 00:49 B2D000164.bkf -rwxr--r-- 1
> M2\backup M2\domain admins 28451419136 2006-04-06 00:49 B2D000165.bkf
> -rwxr--r-- 1 M2\backup M2\domain admins 28448050176 2006-04-08 00:49
> B2D000166.bkf -rwxr--r-- 1 M2\backup M2\domain admins 714
> 2006-04-25 23:00 Changer.cfg -rw-r--r-- 1 root M2\domain admins
> 672743424 2006-04-26 16:55 test -rw-r--r-- 1 root M2\domain admins
> 3363717120 2006-04-26 17:02 test2
>
> This behaviour is reflected by df and du. Am I doing something stupid or
> is this an actual bug? By the way, I the same thing happens whether I use
> reiser or ext3 so I assume that it is not filesystem specific.
>
> Thanks in advance to anyone who can shed some light on this.
The du(1) and ls(1) utilities use the stat(2), fstat(2), or lstat(2) system
calls. There report the size of a file.

df(1) reports the space available/used on the file system, generally in
terms of blocks.

One must remember that these are 2 different things. A 1 byte file may take
up a single block on a file system. ReiserFS tends to optimize itself for
small files.
--
Jerry Feldman <gaf@xxxxxxx>
Boston Linux and Unix user group
http://www.blu.org PGP key id:C5061EA9
PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9

< Previous Next >
Follow Ups
References