View Single Post
Posts: 236 | Thanked: 223 times | Joined on Oct 2009 @ NE UK
#52
Thanks for the interesting link. Just one minor nitpick (I can't help myself )

Originally Posted by SubCore View Post
"du" however reports the actual size of the files
Well, kind of. du is supposed to report the disk allocation associated with the file. On an ext3 filesystem where the block size is 4k, even a 1 byte file will have a 4k block allocated to it, and du will show this.

On a compressed filesystem, this might be misleading because the "4k block" has only a virtual existence and doesn't reflect the actual disk usage associated with the file. At least as I understand it.

You can see this below. ls shows the file size (1 byte) whereas du shows (what it thinks is) the disk allocation..

~# echo > testfile
~# ls -l testfile
-rw-r--r-- 1 root root 1 Dec 22 12:18 testfile
~# du -h testfile
4.0k testfile
 

The Following 2 Users Say Thank You to kwotski For This Useful Post: