On Friday 30 December 2005 13:04, [EMAIL PROTECTED] wrote:
> Hello,
> du of lastlog reports 120K size ls of lastlog reports 38M [EMAIL PROTECTED]
> root]# du -sh /var/log/lastlog 120K /var/log/lastlog [EMAIL PROTECTED]
> root]# ls -lah /var/log/lastlog -rw-r--r-- 1 root root 38M Dec 30
> 13:30 /var/log/lastlog
>
> Why du and ls reporting differnt size of the same file?
>

very interesting indeed. I checked out man du and I found a switch which 
would give me the exact size as ls -lh gave.

[EMAIL PROTECTED] log]$ du -h lastlog
52K     lastlog

[EMAIL PROTECTED] log]$ ls -lh lastlog
-r--------  1 root root 19M Dec 30 18:08 lastlog

[EMAIL PROTECTED] log]$ du -h --apparent-size lastlog
19M     lastlog

Here is what man had to say about the --apparent-size switch:

--apparent-size 
print apparent sizes,  rather  than  disk  usage;  although  the     
apparent  size is usually smaller, it may be larger due to holes            
in (‘sparse’) files, internal  fragmentation,  indirect  blocks,          
and the like.

Wikipedia didn't have anything significant to tell me either.

Experts, please clarify!

-- 
Dinesh A. Joshi

--
http://mm.ilug-bom.org.in/mailman/listinfo/linuxers

Reply via email to