2007/12/6, Jean Christophe Andr? <jean-christophe.andre at auf.org>:
> Nguyen Vu Hung a ?crit :
> > I still don't know what is the different between df's ouput and the size 
> > that ls -l | awk '{print $5}' reports.
> >
> The "df" command is for total filesystem size. It will display you the
> used/free block occupation. So it's not about files on it but only about
> free blocks in the filesystem. Take care about the fact by default
> ext2/3 reserve 5% for root usage only (or other specified user/group).
> You can change this using "tune2fs -m P", with P the percentage.
>
> The "du" command is for total block occupation in a directory hierarchy,
> starting from the current directory by default. It's also about block
> usage, not file size.
>
> E.g. :
>
Thanks. That was 5% is the point.

Btw, I found that my question was indeed a FAQ:

http://www.gnu.org/software/coreutils/faq/coreutils-faq.html#df-and-du-report-different-information
http://www.gnu.org/software/coreutils/faq/coreutils-faq.html#df-Size-and-Used-and-Available-do-not-add-up

And I think the output of du is independent from block size, unless we
set its option --block-size

[vuhung at teriyaki include]$ du -sk --block-size=4096
629
[vuhung at teriyaki include]$ du -sk
2516    .
[vuhung at teriyaki include]$ du -sk --block-size=1024 <- this is the
system-set block-size
2516    .
[vuhung at teriyaki include]$ du -s
2516    .
[vuhung at teriyaki include]$


-- 
Best Regards,
Nguyen Hung Vu
vuhung16plus{[email protected]
An inquisitive look at Harajuku
http://www.flickr.com/photos/vuhung/sets/72157600109218238/

Trả lời cho