Mailinglist Archive: opensuse (3337 mails)

< Previous Next >
Re: [SLE] df and du reporting incorrect file sizes
  • From: James Watkins <misterwatto@xxxxxxxxx>
  • Date: Thu, 27 Apr 2006 18:12:47 +0100
  • Message-id: <4450FB8F.3060409@xxxxxxxxx>
Jerry Feldman wrote:
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.

Thanks for the reply Jerry, but I'm not sure that the byte/block confusion is the source of my
problem. I've noticed that this is the only directory on the filesystem for which the total is incorrect and also that the 'real total' (calulated by hand, admittedly with some degree of inaccuracy) appears to be greater than the capacity of the volume as reported by df. I was wondering if the 27GB files are acually smaller and ls is reporting their size incorrectly.
I have attached the output of 'ls -lhR' together with the output of 'df -h' (the filesystem in question is the last in the list).

Thanks again for your help,

James.

< Previous Next >
Follow Ups