Where'd my darned flash go!

I received a question this afternoon from my cousin about the amount of free flash in her MacBook Air and figured that the answer would probably be useful to others as well. Note that none of this is officially from Apple, so it might be wrong, but I have had quite a few SSDs and the vast majority of it is correct, or at least a jumping off point.

So, my tech-savvy cousin sent me the output of "df -k" in terminal and wondered: "Where's the rest of my hard disk space?" As background, she has a MacBook Air with a 128GB Hard disk and the output of df is:

Filesystem                        1024-blocks      Used Available Capacity  Mounted on
/dev/disk0s2                        117649480 114646588   2746892    98%    
/devfs                                    179       179         0   100%    
/devmap -hosts                              0         0         0   100%    
/netmap auto_home                           0         0         0   100%    /home

There are a number of things that are at play in this.

First, 128GB is 128,000,000,000 bytes and the 1024 blocks are in 1024 byte chunks. So, your 117,649,480 is 120.4730 billion bytes. Then, if you're running Lion (which you should be), there will be the recovery partition, which is hidden but absorbs about 1.3GB on my MacBook Pro.

The remainder is likely to be formatting slop and wear leveling space. The latter is used to make sure that things don't go haywire as SSDs have some peculiar requirements as to how data is written, etc.... this is one of the reasons that Apple bought a flash memory controller manufacturer in Israel late last week.

Any rate, as for the "private", that's the disk space that is required to make your computer work well. The VM is what is called "virtual memory backing store" and provides space for the computer to store stuff that should have been in memory if your computer had 8 or 16 or 32GB of RAM. Without it, you would have to quit more frequently out of programs in order to get other programs to run. (Incidentally, there is no VM on the iPhone and iPad, because they just kill off programs that are taking up memory in the background, but that can't be done with Apps on the Mac very easily, since they were mostly written a long time ago... the good news is that with Lion there is infrastructure for apps to support this kind of behavior in the future). The Sleep Image is what allows your computer to go into deep sleep and not use any/much battery when you have the lid closed. Here you can be thankful you have only 4GB of RAM, because my laptop eats 8GB for its sleep image....

So, in summary, this all looks pretty normal under the circumstances. You can turn off the sleep image, but I would strongly suggest against it. As a general rule, you want to keep between 8-16GB Free as a minimum on SSDs, and 30-50% free on rotating (old style) disks in order to maximize performance. The more full your disk, the more rewrites you flash will take and the sooner it will wear out.

In the end, as with all disks, it's a balance between performance and longevity vs what you want to have with you. The trade-offs are different between rotating media and solid-state, in that disks can wear out without much writing, whereas an SSD that is read most of the time will have very little "wear".