OFFICIAL SECURITY BLOG

We’ve moved! You can now read the latest and greatest on Mac adware and malware at Malwarebytes.

Missing disk space in Lion

Published August 17th, 2011 at 8:16 AM EDT , modified June 19th, 2012 at 5:20 PM EDT

I can be a little obsessive sometimes. I have this OCD need to know how much disk space I have free, for example. Since the release of Mac OS X 10.7, known as Lion, others like me have noticed a troubling problem. It seems that, in Lion, when you drop something in the trash and then empty the trash, the space that item occupied is not recovered. Seems like a major bug, right? But wait… believe it or not, Lion is behaving exactly as designed in this regard! How is that possible?

The answer lies with a new feature of Time Machine, called local snapshots.  If you use Time Machine, you will now have temporary backups stored in a hidden folder on your hard drive.  These snapshots are, from my testing, kept for one week, after which point they are removed.  I haven’t found much in the way of documentation for this new feature, so I’m unsure of what triggers the addition of a file to the local backup.  Certainly, it seems, any file that is deleted is added to the backup.  And this, it seems, is the source of the problem.

Let’s consider an example.  Suppose you have a 2 GB video file that you don’t want anymore, and you’ve only got 10 GB of free space.  You should really keep more than that free, so you toss the video into the trash and empty it.  And when you look at your free space, you’ve still only got 10 GB free, because that file has not actually been removed yet.  It’s in the local backup, and will remain there for one week.  After that week is up, you’ll suddenly see your disk space increase by 2 GB (assuming that was the only thing you deleted that day).  Further, if disk space gets too low, some or all of the backups will be deleted automatically to make more room.

Local snapshots can be a good thing.  If you’re away from your backups and you accidentally delete a vital file, you’ll be quite glad to have your local backup!  You’ll be able to restore the file, using the Time Machine interface, without even needing your Time Machine backup drive (or Time Capsule).

Note, though, that one should not mistake a copy on the same physical media as the original for an actual backup.  If your hard drive dies, for example, both copies are out the window.  Too many people don’t have adequate backups, and the local snapshots feature is not going to help that situation.  Be sure you are connecting your Time Machine backup drive frequently.

Also, it’s important to understand that fluctuation in your free space is normal.  Your Mac writes virtual memory swap files to the hard drive that are quite large and may cause some noticeable changes in free space.  There are also log files, caches and other such things that all can cause noticeable disk use.  Do not expect to be able to see your disk usage remain at a constant value.

That said, if you do have a good reason to want this turned off, note that you can turn it off by opening the Terminal (found in the Utilities folder in your Applications folder) and entering the following command:

sudo tmutil disablelocal

When you press return, you will be prompted for your account password.  Enter it at the prompt and hit return.  (Note that this only works from an admin user account.)  Afterwards, the local snapshots should be deleted, though this might take a little while if yours are very large.

If you ever want to turn local snapshots back on, simply use the same command, but replace “disablelocal” with “enablelocal”.

Tags: , ,

5 Comments

  • sadiq says:

    I have also experienced something similar on my mac os x 10.7 (Lion). But in my own case it’s slightly different, may be worse. i was frequently running low on disk space. When i delete some items n empty my trash, the disk space increases as it should. But when i click the “get info” from the hard drive options, i see that the “available disk space” keeps reducing rapidly while the “used disk space” increases. i got frustrated at some point after i deleted almost all my personal files from the built in hard drive.
    But the problem stopped after i disabled my “mail” application. so i concluded that was where the problem was coming from.
    I am not so good with computers so i figured someone from here can help.

    • Thomas says:

      Not sure what’s going on there. Could be a runaway log file, or could be that Mail was trying to download a bunch of e-mails from the server due to a settings change, or could be something else entirely. You should try posting on the Apple Support Communities, someone there ought to be able to point you in the right direction. (Just be aware it’s a noisy place there right now, as it is following every major Mac OS X release!)

  • Tibo says:

    I have the same problem than Sadiq, it’s really annoying… For me it’s only when an external hard drive is plugged in… I am going to try without mail app running…

  • Thomas Jim says:

    Have you tried rebuilding your mailboxes? It worked for me.

  • Eric says:

    Hi Thomas, I have exactly the problem you describe. Would like to check with you tho, once i disable local, the disk space doesn’t come back immediately? so i will still need to wait for a week? LOL. this prob have been bugging me for the last 24 hours… can eat, sleep, s**t, or do anything…

This post is more than 90 days old and has been locked. No further comments are allowed.