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

Re: Wrong size with ls



Prakash Countcham <prakash.countcham@imag.fr> [2002-12-07 21:23:36 +0100]:
> 
> I've just installed a Debian Woody (stable) and I encourtered something 
> strange in my '/var/log' directory.
> When using both the '-l' and '-s' options of 'ls', the sizes given are 
> incoherent.
> For information, 'du -k' gives the same sizes as 'ls -s'.

I looked at your example closely but I could not find anything
"incoherent" about it.  Could you be more specific?  Everything looked
fine there to me.

Something to remember is that files can vary in size from zero to any
arbitrary value.  We measure that in bytes and is the data reported by
ls -l.  But the filesystem is allocating space in terms of disk
blocks.  That will be 512 bytes or 1024 bytes or whatever dependent
upon the filesystem.  Also, a filesystem may require several blocks
per file even if the file is zero length.  The value reported by ls -s
and du are the number of disk blocks consumed.

Disk blocks used and size of files are related only in that the latter
will always be less than the former on an uncompressed filesystem.

Bob

Attachment: pgpPwhur6LZdB.pgp
Description: PGP signature


Reply to: