• On Metacritic: 22 film directors who started on MTV
advertisement
April 16, 2004 2:15 AM PDT

Disappearing hard disk space

by CNET staff

In some instances, Mac OS X volumes will display a significantly lower remaining disk capacity than expected based on installed applications and residing files. Sometimes the dramatic loss of space can happen suddenly - after a Mac OS X update or application installation - or gradually over time.

One MacFixIt reader recently wrote:

"I updated to Panther last evening. Everything worked fine and there was about 20+ GB of free HD space available. After running Software Update, and updating to 10.3.3 via the Apple Combined Update, I suddenly had only 20 MB of space left."

Aside from limiting expansion of your data set, low disk space (less than 10% of total capacity in most cases) can cause serious performance problems in Mac OS X.

If you suddenly find yourself with less available disk capacity than you expected, there are some fairly easy measures that can reclaim the lost space.

Corrupted B-Tree Mac OS X's HFS+ filesystem makes heavy use of B-Trees, and as such (even though HFS+ has built-in on-the-fly defragmentation) is subject to B-Tree corruption that can result in disk space measurement errors.

In some cases Apple's Disk Utility (located in Applications/Utilities) will be able to resolve these issues and is a good place to start. However, especially when header node problems are involved, third-party tools like DiskWarrior, Norton Disk Doctor, and Drive 10 can sometimes be more effective.

Leftovers from burned media Another thing to keep in mind is that if you burn a CD or DVD, the recording application (the Mac OS X Finder, Toast, iTunes, etc.) will create a temporary file matching the burned media's size.

Generally, if the temporary files are not immediately deleted, restarting will remove them.

Lack of ram and swapfiles If you run low on RAM, Mac OS X's VM system will create swapfiles. Sometimes - even with a healthy amount of installed memory - these files can become extremely large.

Aside from buying more RAM, you can use a tool like Cocktail to delete swapfiles, though they are likely to refill soon after when more applications are launched without a restart.

To keep track of your disk vs. RAM usage, keep a tool like Menu Meters handy. This application can display current memory usage as either a pie chart, thermometer, history graph, or as used/free totals. The Memory Meter menu shows a breakdown of current memory usage and VM statistics. It can also optionally display a paging indicator light when swapfiles are being used.

Re-apply combo updater In some cases, simply repeating the update installation process can restore seemingly lost disk space.

Check for invalid preference files In some cases, .plist (preference) files can inexplicably swell to enormous sizes. The utility Preferential Treatment (which was mentioned in this month's mac.column.ted) an interface for the plutil command, which can find invalid XML files - all valid .plist files are also valid XML.

Search for extremely large files In addition to seeking out invalid, possibly swollen .plist files, you can also simply perform a search in the Finder (File -> Find) for files that are suspiciously large; 100 MB, 1 GB or 10 GB depending on your volume size and file mix.

A tool like File Buddy can also help you find such files - visible or invisible.

Log files- such as those generated by the Mac OS X Console - can also swell to 10 GB or larger. You can clear these files by using the above search method, or more easily with a utility like Cocktail, or OnyX (freeware).

Feedback? Late-breakers@macfixit.com.

Resources

  • DiskWarrior
  • Norton Disk Doctor
  • Drive 10
  • Menu Meters
  • mac.column.ted
  • File Buddy
  • Cocktail
  • OnyX
  • Late-breakers@macfixit.com
  • More from Late-Breakers
  • Recent posts from MacFixIt
    iTunes 10 user interface sees some minor changes
    Apple seeds iOS 4.1 Gold Master to developers
    Possible fix for Harman Kardon iSub problems with PowerPC Macs
    Precautions to take before installing iTunes 10
    A reminder on how to reset your Mac's system password
    Mail messages appearing blank
    Adobe Lightroom update brings direct Facebook publishing; Camera Raw 6.2 released
    Weekly troubleshooting utilities update
    Add a Comment (Log in or register) Showing 1 of 2 pages (21 Comments)
    by woodysky April 16, 2004 7:38 AM PDT
    FileVault will retain disk space that has ben trashed and emptied until
    shutdown.
    Reply to this comment
    by earthsaver April 16, 2004 7:41 AM PDT
    TechTool Pro: Shouldn't you be mentioning TTP 4 instead of Drive 10?,
    especially in the context of Panther.

    Swap file size: On my Q16 with only 512 MB RAM, I've discovered the
    truth about swap file sizes. The first two are 64 MB each, the third is 128
    MB, the fourth is 256 MB, and each of the rest is 512 MB.

    So, the first four amount to 512 MB and each that gets created in addition
    adds half a GB to the total. I've on occasion had as many as 12 swap files
    crowding my system, amounting to 4.5 GB of disk used for VM before the
    OS finally starts cleaning up.

    I'm confident that doubling my RAM will solve this most of the time,
    however I can't afford to upgrade right now and test the difference.
    Reply to this comment
    by toddhisattva April 16, 2004 7:41 AM PDT
    <class="merchant"><span>&#62;</span><div class="datestamp"><i>This is a reply to a previous comment by earthsaver</i></div></class><br />
    If the ever-increasing size of the swapfiles is bothering you, you can edit
    <b>/etc/rc</b> to specify a fixed swapfile size. For example, to make nice
    round-number 20 million (decimal) byte files,<P>

    Change the line<br>
    <b>dynamic_pager -F &#36;{swapdir}/swapfile</b><P>
    to<br>
    <b>dynamic_pager -S 20000000 -F &#36;{swapdir}/swapfile</b><P>

    Just insert "<b>-S 20000000</b>" in the line. <P>

    If you have no idea what /etc/rc is, maybe get a geekier friend to do it.
    Editing /etc/rc on a Mac! Yay!
    Reply to this comment
    by hamarkus April 16, 2004 7:55 AM PDT
    According to Activty Monitor my VM size is usually around 8GB. When I restart, it goes down to maybe one or two GB, but within days will go up to 6 to 8GB again. It is then roughly constant, even over weeks without a reboot.

    Interestingly, my free HD space does not go down significantly over the couple of days it takes for VM to go up from 2 to 8GB.
    Reply to this comment
    by 123 April 16, 2004 7:55 AM PDT
    <class="merchant"><span>&#62;</span><div class="datestamp"><i>This is a reply to a previous comment by hamarkus</i></div></class><br />
    This VM size is entirely virtual. My VM size is 7.01 GB, but I only have about 2
    GB of swapfiles (ls gives 2.5 GB, du gives about 1.8, which suggests that the
    filesystem is allocating blocks weirdly).

    I can increase my "VM size" by 3.5 GB in about 10s. This is done by allocating
    memory without actually using it. OSX is reasonably smart and doesn't make
    that memory available until you actually use it.

    If you really want to measure the VM size, ls -l /var/vm/. For a
    more accurate reading, du -s /var/vm (I don't know why they're different, but
    apparently OSX doesn't allocate filesystem blocks until they're used either).
    Reply to this comment
    by bedinal April 16, 2004 9:36 AM PDT
    We've actually run into several instances where hard disk space
    disappeared _after_ running one of the various disk utilities.

    Our customers typically have a 20Gig boot partition. A tech will run a
    disk utility to check for problems. Some problems are found and "fixed"
    but once the utility finishes the 20Gig volume has been "shrunk" to
    1.25Gig (one 5Gig volume shrunk to under 200Mb). The volume is toast
    at that point. Files physically located beyond the first 1.25Gig all show
    zero size. Nothing short of a repartition seems to fix it. If the user's data
    was not backed up prior to running the disk utility then it's pretty much
    gone.

    As far as we can tell there is some pre-existing condition on these
    volumes that causes disk utilities to mess up the # of sectors allocated
    to the volume. We've seen it occur when using Norton, DiskWarrior and
    TechTool. It's occurred at least 6 times that we're aware of over the last
    few months.

    Has anyone else experienced anything like this?
    Reply to this comment
    by w i n t e r m u t e April 16, 2004 9:36 AM PDT
    <class="merchant"><span>&#62;</span><div class="datestamp"><i>This is a reply to a previous comment by bedinal</i></div></class><br />
    Are you running Panther 10.3.0? This sounds like the "zero data corruption"
    problem know to the initial release of Panther. If you haven't updated to
    10.3.1 or higher, you will need to do so to avoid this nasty bug, which I
    believe was also related to the use of FileVault. Also be sure that if you are
    running any utilities from a boot CD, that they are not running from 10.3.0 as
    well.
    Reply to this comment
    by MysticalOS April 16, 2004 9:36 AM PDT
    <class="merchant"><span>&#62;&#62;</span><div class="datestamp"><i>This is a reply to a previous comment by w i n t e r m u t e</i></div></class><br />
    Diskwarrior cd 3.0.1 uses 10.3, Techtool 4.0.1 cd uses 10.3 but the new
    4.0.2 cd uses 10.3.2, Norton Systemworks 3.0 uses 10.3, but 3.0.1 cd uses
    10.3.2, Make sure you are using latest cd's using 10.3.2, i don't know if
    diskwarrior has made one or not but so far this is what i've seen.
    Reply to this comment
    by WhiteDog April 16, 2004 9:36 AM PDT
    <class="merchant"><span>&#62;&#62;&#62;</span><div class="datestamp"><i>This is a reply to a previous comment by MysticalOS</i></div></class><br />
    Cocktail and Panther Cache Cleaner, among others, can run the routine Cron
    scripts as well as many other useful system maintenance tasks and do so at
    your convenience. I recommend regular use of one of these. As for the boot
    system of DiskWarrior, TechTool Pro, etc., the best way to deal with this and
    related issues is to create a boot partition on a hard drive (internal or
    external) dedicated to these utilities. Not only does a hard drive partition
    start up much faster than a CD, you can easily keep both the OS and the
    utilities updated without worrying about shelling out $20 for a new CD every
    time your favorite utility is updated. There is also the convenience of having
    access to all your utilities at the same time, eliminating the need to reboot
    from separate CDs. If you have to support other machines besides your own,
    an external FireWire drive can provide you with a mobile toolkit.

    ---
    Don't anthropomorphize computers.
    They hate that.
    Reply to this comment
    by 123 April 16, 2004 9:36 AM PDT
    <class="merchant"><span>&#62;&#62;&#62;&#62;</span><div class="datestamp"><i>This is a reply to a previous comment by WhiteDog</i></div></class><br />
    The cron scripts do nothing particularly important, except log rotation and
    cleaning of temp files. I don't think that would shrink a volume from 20 gb to
    1.25 GB.
    Reply to this comment
    by vancouver8 April 16, 2004 9:36 AM PDT
    <class="merchant"><span>&#62;</span><div class="datestamp"><i>This is a reply to a previous comment by bedinal</i></div></class><br />
    After running Diskwarrior 3.0.1 from the internal of a Powerbook
    800 running OS10.3.4 ,trying to do general maintenance on an
    external WD 160GB with Oxford 911, the TOTAL DRIVE
    CAPACITY was reduced to 128 GB! (which obviously lowered my
    available space)
    Reply to this comment
    by Saklad78231 April 16, 2004 10:08 AM PDT
    A few weeks ago, I suddenly dropped 12 Gb of free disk space on my
    PowerBook G4 running Panther with all updates. There were no recent
    changes, I just rebooted and I noticed <i>poof</i> that the space was
    gone.

    I have just rerun the Combo 10.3.3 updater with no change and
    performed a search of my drive with the Find command searching for large
    files (visible and invisible).

    I discovered that my /private/var/tmp/ directory contains 414 files and
    folders that amount to 14+ Gb of space. The dates of the files range from
    12/17/2003 to now. This appears to be a major source of my space
    problem.

    I had been under the impression that the tmp directory was routinely
    emptied by the maintenance scripts. Clearly an incorrect impression!

    My question is: <b>Can I reboot (to make sure that nothing is actually
    using one of the tmp files) and delete the contents of the /private/var/tmp/
    directory?</b> Can I do this with the Finder, or do I need to use a special
    UNIX command in the terminal? If so, what is the safest command to use?<p>---<br><br />
    /////////////////////////////////////<br />
    /<br />
    /
    Reply to this comment
    by bastronaut April 16, 2004 10:08 AM PDT
    <class="merchant"><span>&#62;</span><div class="datestamp"><i>This is a reply to a previous comment by Saklad78231</i></div></class><br />
    You shouldn't delete the directory itself, but you can usually delete the files that are in there.

    The stuff in there is supposed to be unimportant. If you are running any extra UNIX tools or custom programs, they may be creating stuff. I run my system non-stop and run a lot of programs, from httpd to the dev tools and everything in between, and my /tmp has about 200k of data in there, so it would be interesting to know what's going on with yours.
    Reply to this comment
    by Saklad78231 April 16, 2004 10:08 AM PDT
    <class="merchant"><span>&#62;&#62;</span><div class="datestamp"><i>This is a reply to a previous comment by bastronaut</i></div></class><br />
    Many of them appear to be created by StuffIt. Some have names that are the
    same as files that only exist in StuffIt archives. They are <i>much</i> larger
    than the original files. Some of the files and folders have cryptic names that I
    associate with "temp" files.

    Shouldn't all of the /tmp/ directories be cleaned out by a maintenance
    routine if it is not deleted for some reason by the original program?<p>---<br><br />
    /////////////////////////////////////<br />
    /<br />
    /
    Reply to this comment
    by 123 April 16, 2004 10:08 AM PDT
    <class="merchant"><span>&#62;&#62;&#62;</span><div class="datestamp"><i>This is a reply to a previous comment by Saklad78231</i></div></class><br />
    As an oversight, the 'periodic' scripts (which run every day/week/month) are
    scheduled to run at around 3 AM, so as not to mess up your work schedule.

    It is my opinion that all temp files should be deleted by the programs which
    created them, though.
    Reply to this comment
    by piddles April 17, 2004 1:52 AM PDT
    I had this problem, also the computer was running very slowly and would
    frequently crash. G4 MDD 1 Gig, 60 Gig HD actual files should leave about 7
    Gig free but it was reduced to about 3.
    Ran Diskwarrior, found a few of apples hidden files that were partialy
    overwritten, repaired those and now works fine, back to normal.
    Reply to this comment
    by MysticalOS April 17, 2004 1:52 AM PDT
    <class="merchant"><span>&#62;</span><div class="datestamp"><i>This is a reply to a previous comment by piddles</i></div></class><br />
    The routeen scripts run at 3:15AM(daily) every night, 4:20AM every saturday
    (weekly) not sure for monthly but probably similar "low time" of computer
    use, if computer isn;t on during these times these scripts NEVER run..unless
    done so manually..tiny little glitch for those that shut their computers down
    at night. Perhaps To be concidered.
    Reply to this comment
    by Chiwo April 19, 2004 2:36 AM PDT
    <a href="http://www.omnigroup.com/applications/
    omnidisksweeper/">OmniDiskSweeper</a> is an excellent free tool which
    can help you find out where your disk space has gone. It will help you quickly
    track down which folders and files are occupying the most space.
    Reply to this comment
    by local April 19, 2004 2:36 AM PDT
    <class="merchant"><span>&#62;</span><div class="datestamp"><i>This is a reply to a previous comment by Chiwo</i></div></class><br />
    I was suddenly missing 30 gigabytes and, working my way down the list of
    suggestions, I finally tried Omni Disk Sweeper.

    Oh! look! a 30 gigabyte MP3 file! I wonder it that didn't show up when I
    searched the disk for big files?

    Problem solved, thank you very much for the suggestion.
    Reply to this comment
    by LukasM April 19, 2004 4:43 AM PDT
    I have found that Applejack is an extremely useful tool for this kind of
    maintenance. Applejack is a shell script that can be run when you boot in
    Single User mode (cmd-S at startup) instead of the standard fsck (or other)
    routine. It's very easy and it doesn't do any harm if you *read* the
    instructions (they always show up if you start Applejack in SU mode so you
    can't do any wrong). Like this you can repair the startup disk, clean caches
    and the swap files. Under Jaguar you can also repair permissions; this is
    broken in Panther due to an Apple bug in diskutil and will be automatically
    skipped by Applejack.

    http://sourceforge.net/projects/applejack
    Reply to this comment
    Showing 1 of 2 pages (21 Comments)