[wellylug] File Sizes

Steven Mulvay steven.mulvays.groups at paradise.net.nz
Wed Dec 29 16:44:14 NZDT 2004


Hi all, how are you?
I've got a few questions about file sizes and directory sizes, needless to say I don't have a clue how the ext 3 filesystem works because I keep getting some very bizarre readings.

Firstly, yesterday I had a directory which was reported by Konqueror to be 10.4 Mb, I then ran du -h on the same directory which reported the size to be 11Mb. (for those of you who may not know, the -h switch tells du to print sizes in human readable format eg Mbs instead of bytes) I know that this can't be a simple case of rounding, because 10.4 should be rounded down, not up. In this case, do you think that 10.4 Mb could be the "actual" size of the directory and that 11 Mb could be the "size on disk" of the directory?

The second case is a lot more mysterious. I executed the command ls -lha (which prints a long directory listing displaying all files with their sizes quoted in human readable format) on a directory named "picts". I had one jpeg in the "picts" directory whose size was reported to be 205K aswell as the file called "." and the file called "..", worth 4K each. 205K+8K=213K, yet the total size displayed at the top of the ls -lha listing was 220K. That's a difference of 7k, why would the total size at the top of the ls -lha listing be 7K larger than the sum of all the items listed? I ran du -h on the "picts" directory immediately afterwards and it's size was reported to be 216K, that is a big improvement but it's stil 3K larger than 213K.

In my third case of experimentation I had the same jpeg in the "picts" directory worth 205K aswell as a different jpeg worth 559K, plus the "." file and the ".." file worth 4K each. 8K+205K+559K=772K, yet the total size displayed at the top of the ls -lha listing was 784K. Why would the total size at the top of the ls -lha listing be a massive 12K larger than the sum of the listed items? 

As I said before I don't have a clue why I'm getting such bizarre file size readings. If the ext 3 fliesystem format really wastes as much disk space as it appears to I might see if it's possible for a Mac to run Linux on an hfs+ partition. As always, any help would be greatly appreciated. I hope I don't seem grumpy in this e-mail, because I'm not grumpy, just confused.

Cheers,
Steve




More information about the wellylug mailing list