Why is it important to keep lots of freespace on OSX? What is the impact?
I have a 500GB drive and have less than 50 GB free. Console is reporting several interesting errors saying I'm too low on space and it's cleaning up "stuff"
1/6/13 4:49:51.475 PM com.apple.mtmd[452]: attempting to thin because of low free space on Macintosh HD (/) by removing 2013-01-06 15:50:13 -0500, estimate 0 bytes to recover, 1 snapshot can be thinned
- Why should I have sufficient free space on my drive?
- Since I have a large drive, does it mean I need 10% of a 50 GB drive free? (that's a lot)
- Now that I'm low on space, what is the system deleting and fixing that it doesn't do normally?
Solution 1:
OS X has several built in tools that suspend themselves when space is low. iOS has a far more evolved system where space is much more precious, and over time, those mechanisms are finding their way into OS X as well:
- General HFS+ optimization on spinning HD such as delayed allocation, pre-allocation and on the fly defragmentation of files
- local Time Machine snapshots (10.7 and later)
- Photos database (10.10 and later) can "reoptimize" and reduce storage when you run low.
- Cached files in ~/Library/Caches and /Library/Caches will probably get harvested under the correct storage pressure (no space for swap for instance). Look for iTunes music cached files, iCloud synced files
In the case of very large swings in storage, look first at Time Machine trying to thin the local backups when storage runs low past the "warning" level. Once those messages are logged to /var/log/system.log the time machine daemons will be more aggressive about pruning old backups, but not suspending local backups entirely.
Hot file optimization is where small files that are read from or written to often get tiered to the fastest portion of a spinning hard drive.
Keeping a little free space (I believe mtmd thinning begins at 20% of the volume) means you can have a longer range of local Time Machine snapshots to protect you from deleting a file or erasing some work without needing to connect an actual Time Machine drive to recover that file.
With more free space on the drive, the other optimizations can make your drive work faster, so it's more a performance issue when you get less than 10 or 5 GB of free space since the system has less flexibility in optimizing for speed and has to just write a file where there is room as opposed to where it would best be kept to minimize file fragmentation.
You can also run the periodic
cleanup scripts to see if rotating log files and pruning files in the various /tmp directories help in emergency cases. I've even gone so far as cleaning cached files after quitting the apps to get temporary reprieve to let a critical task finish or get a good backup of files before restarting the system to recover from the manual deletion.
My experience is you don't really see significant slow downs until you get to less than 15 GB of space - and sometimes not even until you get into the 5 GB of free space. In fact, these caching designs speed up the OS and help with recovering files (in the case of Time Machine local backups). Running benchmarks can tell that drives start to slow down once you get them 30% full - so SSD are far more level in performance due to the lack of rotational time delays and head seek delays. They also have some overhead to allow a full drive to still have room to juggle delete and write operations since they address storage in larger chunks than the typical block size of an I/O.
Solution 2:
You need to keep some space free for OS X's use (temporary files, virtual memory swap files, etc), and it's also good to have free space to avoid file fragmentation (if the disk is mostly full, the system is more likely to have to break a file up to fit it in the available nooks and crannies). However, 50GB free should be plenty; for these purposes it doesn't matter much how big the drive is, just how much space is free.
The message you're seeing in Console is a bit different. It comes from the mobile time machine daemon (mtmd); this is what takes "local snapshots" -- essentially, it backs up within the local drive when your external backup target isn't available. Local snapshots are considered to be a low-priority use of disk space, so mtmd will erase them if the disk gets more than 80% full (and erase them even faster if it gets above 90%). Because of this, if you show the available disk space in Finder, it counts that used for local snapshots as free; if you want to see what's really going on, look in System Information (Apple menu > About This Mac -> More Info button -> Storage tab).
So if you want your system to keep local snapshots, you need to keep more than 20% of the drive free. But frankly, if you're concerned about backups you really should concentrate on connecting to the real backup target as often as possible, and not worry too much about local snapshots.