On Friday 30 December 2005 13:04, agencies_ad1(a)sancharnet.in wrote:
Hello,
du of lastlog reports 120K size ls of lastlog reports 38M [root@c-106
root]# du -sh /var/log/lastlog 120K /var/log/lastlog [root@c-106
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.
[basix@linuxbox log]$ du -h lastlog
52K lastlog
[basix@linuxbox log]$ ls -lh lastlog
-r-------- 1 root root 19M Dec 30 18:08 lastlog
[basix@linuxbox 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