Sparse Image Size Question

Posted:
in Genius Bar edited January 2014
My question is: Shouldn't the size of a sparse image on your HD dynamically shrink if you delete its contents?



I have a 22 GB Sparse Image on an external USB 2.0 HD. I just deleted about 18 GB of its contents, and deleted the .Trash files manually. However, while OmniDiskSweeper informs me that I only have about 4 GB on the image, it's taking up 22 GB on my HD.



Maybe I'm confused about how sparse images work.



Am I?



--B

Comments

  • Reply 1 of 2
    pubguypubguy Posts: 108member
    Well, by definition, the sparse image automatically GROWS. You can shrink it fairly easily. I found this on MacOSXhints.com



    "Well it turns out shrinking those bloated sparse images is not a problem. Just unmount the image if it is mounted. Then pull up a Terminal window and type:



    hdiutil compact /some_path/your.sparseimage



    where /some_path/your.sparseimage is the path and file name of the sparse disk image. This will harmlessly reduce the sparse image down to the minimal size needed to contain the files within it. It does not erase the disk image and you won't lose any files doing this. As a side effect, it is likely the files in the image and the imagefile itself will be defragmented in the process. The process is very fast if the image is mostly empty.



    Of course it is a swell idea to make a backup copy of the sparseimage before you compact it, just in case!"



    I haven't tried it, but it seems simple enough to do and should solve your problem.
  • Reply 2 of 2
    bergzbergz Posts: 1,045member
    Quote:

    Originally posted by pubguy

    hdiutil compact /some_path/your.sparseimage



    Didn't work for me. Spent about 5 minutes doing something, but in the end it was still at 22 GB. I ended up copying the files I wanted out of there and into a folder, deleting the sparseimage.



    Thanks for the tip, though.





    --B
Sign In or Register to comment.