2008/3/7, Jean Christophe Andr? <jean-christophe.andre at auf.org>:
> Nguyen Vu Hung a ?crit :
>
> > Why du -sh and ls -lh gives different results??? ( 701MB and 9.4MB )
>  >
>  > [vuhung at aoclife $ ls -lh
>  > total 9.4M
>  > -rw-r--r-- 1 vuhung vuhung 701M Jan 27 23:03 file.avi
>  > -rw-r--r-- 1 vuhung vuhung  904 Jan 26 02:18 file.ssa
>  > -rw-r--r-- 1 vuhung vuhung 1.2K Jan 26 02:18 file.txt
>  > [vuhung at aoclife $ du -sh
>  > 9.4M
>  >
>
> Because "du" shows the real disk usage hence "ls" shows the declared one
>  (which is not the same as reserved).
>
Thanks,

The current file system is ext3 which supports sparse files.
FYI, I've found a good explaination on wiki:
http://en.wikipedia.org/wiki/Sparse_file

>  Here it's probably because your file.avi is mostly full of zero which
>  will not be stored in a filesystem with "sparse" support (like ext3).
>  Most modern technologies (especially P2P, like bittorrent) use this
>  capability.
>
Wiki says "most file systems nowadays support sparse files". Afaik,
ext3 and NTFS5 support it.

For example, Aruzeus[1] support 3 kinds of file allocating:
Pre-allocate ( reserve but actually does not write to disk ),
Pre-allocate and zero ( reserve ) , Incremental ( write-as-need ).

[1] http://www.azureuswiki.com/index.php/ConfigFiles

-- 
Best Regards,
Nguyen Hung Vu ( Nguy?n V? H?ng )
vuhung16plus{[email protected]
An inquisitive look at Harajuku
http://www.flickr.com/photos/vuhung/sets/72157600109218238/

Trả lời cho