MacOS size weirdness

Peter Bagnall yellowdog-general@lists.terrasoftsolutions.com
Sat Jul 13 17:56:01 2002


The only think I can think of here is the block size.

The minimum unit of disc space is the block. Depending how you format 
your disc this can range from about 512 bytes upwards. 4KB is typical.

Any file is stored in an number of blocks. Blocks cannot be shared 
between files. So, lets say you have a file that is 100 bytes long on 
disc with 4k blocks, that will take up one block, wasting 3996 bytes. 
This is reported as 4KB of disc usage, but only 100 bytes of file.

That means that if you have a disc with a large block size and lots of 
small files the amount of disc space used will be much greater than the 
total size of all those files. MacOS is actually very accurate about 
reporting disc usage, but the thing that is confusing is gives you both 
the measures. When you look at how much of the disc is used it's 
basically seeing how many blocks are used. But when you look to see how 
big a folder is you're seeing the sum of all the file sizes, but that 
doesn't take into account the wastage in many blocks, and so it looks 
smaller.

Try this... create yourself a small text file, just a few bytes long 
with simpletext or some similar program. Now do get info on the file. On 
my system it reports the size as "4 KB on disk (3 bytes)". The three 
bytes bit is the actual length of the file, but the "4 KB on disk" 
indicates that I've used a whole 4KB block for that file, wasting 4093 
bytes.

If you have a big file it is stored in several blocks, so most of them 
will be full, with the last one wasting a little space. The upshot of 
all this is that if you expect your system to have lots of very small 
files, format with a small block size, if not go for something typical 
like 4KB.

You pay a performance penalty if you reduce the block size too much 
though, so unless you have really pressing reasons I'd advise just 
leaving it alone. The disc also has to maintain a free block map, so the 
more blocks you have (by making them smaller) the bigger the map is. A 
balance is important here. That's why 4KB is typical.

When you copy those files over to the other partition and they suddenly 
take more space, this is almost certainly because the block size on that 
partition is bigger, and so more space is being wasted. The only option 
here, if that's a problem is to reformat with a smaller block size.

Finally, this is the way all OS filesystems work at the moment. When I 
say all I include windows (all of them), MacOS (all of them), Unix, 
Linux, etc and so on. There may be some solutions which reduce the 
impact of this in some ways, and maybe others on the list will know 
some. The only one I can think of it so make archive files of any large 
collections of small files you may have (thereby making one big file). 
But that means it's harder to use them, so isn't probably very 
practical, and certainly the OS won't take kindly to being archived!

MacOS here is actually being possibly a little to honest for it's own 
good and making things seem a bit weird in the process, but I assure 
you, it is more than likely getting it's sums right ;-)

Hope that all makes sense.

As for asking lots of question, I for one am glad to get one I can 
answer!

Pete


On Sunday, July 14, 2002, at 12:20 AM, <astout2@swarthmore.edu> wrote:

> First, thanks for the help with the error in my install--I'm about to go
> repartition and see if things get better.  Second, sorry for flooding 
> the list
> with so many messages (and on a Saturday, no less).
>
> This one isn't exactly about YDL, but it has to do with sizing 
> partitions:
> MacOS 9.1 is lying to me about the sizes of folders on my mac system
> partition.  I first noticed this when I was backing everything up, but 
> I didn't
> think much of it until the same thing happened, more aggregiously, on a
> brand new install of the system software.  If get info on the System
> Folder or Applications folder on my MacOS system partition (which is
> 1Gb), or tell the finder to calculate folder sizes, it tells me my 
> System
> Folder is 251 Mb and Applications 81 Mb.  Those are the only things on
> that partition, except "Documents" and "Late-breaking news", both of
> which are small.  But if I get info on the volume, it tells me 636 Mb 
> are
> used on the volume.  251 + 81 + a little bit =/= 636.  And when I try to
> download a big iso image, my FTP client tells me there's no room left on
> the partition.  "Odd", I think, and copy the two folders in question 
> to a
> different volume.  Now they're 429 Mb and 159 Mb.
> These are both HFS Standard partitions, on the same internal drive.
> What gives?  We all know OS 9.1 is inferior to linux, but I'd expect it 
> to be
> able to give me the right sizes on a brand new installation.
>
> Puzzled,
>
> Andrew "this is my last post for the day, I promise" Stout
> _______________________________________________
> yellowdog-general mailing list
> yellowdog-general@lists.terrasoftsolutions.com
> http://lists.terrasoftsolutions.com/mailman/listinfo/yellowdog-general
>