Like most, over the years I have become a creature of habit when using computers for my daily tasks and find myself using the same methods for the same tasks that i've used since I can remember. I almost hope that my methods have become obsolete and outdated and i'm curious to hear how you guys/girls handle similar tasks now, hoping to find a better method for my tasks and to hopefully become more productive in the process.
Ultimately, I am looking for a method to remove (preferably all) as much free space as possible from disk images so that when I need to restore those images to devices with enough space for the actual content, they actually succeed instead of failing because they don't have enough space to hold the empty free space too.
As I mentioned before, i've been using the same method for image "shrinking" since about Leopard, which is when a major contributor to my method was introduced, the sparseimage. Before 10.5 though my method was more complex and way more annoying, but i'll spare you the details of how that went. This is a quick rundown of what i've been going through in order to "shrink" my images and remove as much free space as I could before archiving them away for later use.
1) Create sparseimage/bundle
2) Copy/transfer data to sparse using diskutil (Sometimes CCC)
3) Remove any unwanted or leftover files using Terminal (.hidden files, etc.)
4) While still mounted, erase partition free space using a 7-pass secure removal
5) Repeat step 3
6) Unmount/eject partition
7) Run compact command using hdiutil on sparse
8) Run resize command using hdiutil to minimum size on sparse
9) Mount again to verify free space changes
10) Repeat step 3
11) Repeat step 6
12) Convert sparseimage/bundle to compressed disk image
13) Verify contents for compressed .dmg
Well, there it is. As you may have noticed it's a tedious, time consuming and usually very demanding of disk space process that I go through. My process would probably go a lot faster too though if I wasn't such an anal-retentive perfectionist. As you can tell I spend a lot of time removing unwanted or leftover files (usually created by OS X). I absolutely hate having leftover .com.apple.timemachine.supported .fseventsd .Trashes .Spotlight-V100 and .TemporaryItems files that sneak past me and get on my final compressed .dmgs. So much so that if I have one i'll usually redo the same image over and over again until I get it just the way I want it. That's my problem though and I have gotten pretty good at getting around it. On average i'd say my process is pretty good and usually achieves a 90-98% free space reduction on the final compressed .dmg. Of course though, i'd prefer if I could completely remove all the free space on my final, compressed .dmgs. That's hopefully what I am here to find out.
Anyway, that pretty much boils it down. I hope all that babble makes sense to everyone. If not, i'll try to rephrase it upon request. If any additional info is needed or could be helpful i'll do my best to get it. After all, i'd love to see this one get a nice, simple and solid answer sometime soon. Someone out there must have a more reliable method than mine. I'd love to hear how everyone else performs these tasks. Thanks for reading!



Sign In
Create Account








