[wellylug] File Sizes

Donald Gordon don at dis.org.nz
Wed Dec 29 17:19:22 NZDT 2004


Hi

> 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.

Short answer:

du will round up file sizes to the amount of space the files take on
disk; ls won't.  Filesystems allocate space in blocks that can vary in
size depending on the filesystem type and options used when the
filesystem was created.  And they need space for storing information
about each file, and the lists of files in each directory, and various
other bits of housekeeping information.  It sounds like your ext3
filesystem is using 4kb blocks.

> can't be a simple case of rounding, because 10.4 should be rounded down, not up

And you're sure that the developer of du agrees with you? 

> a massive 12K larger than the sum of the listed items? 

Is 12kb really massive compared to the megabyte of JPEGs in the
directory?

> 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.

If you're that tight on space, you probably need a bigger disk.  If
you're just worried -- then don't be.  You could recreate your
filesystem with a smaller block size if you wanted, but you'd need
somewhere to back up everything on it first.

If you're still concerned about the underutilised space, you could use
reiserfs which tries to coalesce those less-than-a-block tail ends of
files together into a smaller number of blocks.  But you have to create
the filesystem with the correct options, etc.  And you can't (couldn't?)
store a kernel to boot from on a filesystem with this option turned on.

donald




More information about the wellylug mailing list