View Full Version : Delete files from sparseimage?

10-30-2007, 10:26 PM
Sorry if this is elsewhere, I did a quick search and couldn't find it.

I upgraded to Leopard, but I want to hold onto my tiger backup for a while, just in case. I back up to a NAS, so my backup is a sparseimage file. I want to keep the backup, but don't want all the big stuff in it (I'm running out of room on the NAS). For example, I want to delete all my music/movies and my parallels virtual machine.

Is this as simple as mounting the image and deleting files? Will that cause problems mounting in the future? Will it still be bootable?


10-30-2007, 11:13 PM
Well... you can delete that stuff, but your image won't shrink. You'll have to then use hdiutil to shrink it. Basically open Terminal, type:

hdiutil compact

with a space after it, drag in the image file and press Return...

10-30-2007, 11:35 PM
What do you mean "drag in the image file"? You mean literally click it in finder and drag it on top of terminal? The sparseimage file is on my NAS, will it have to copy the entire thing onto my local harddrive? Does this whole process take a long time and/or use a lot of physical space while it's working? What are the chances of it screwing up the image? Sorry for all the questions, I just want to protect my data! :)

10-30-2007, 11:54 PM
I mean what I said -- drag the file into Terminal. It'll just type the full path there for you. Compression of the image is likely to take some time...

10-31-2007, 02:40 AM
That worked perfectly! I took my sparseimage file from over 147gigs to 37! And it looks like everything's still working in terms of mounting and accessing files. The process took about 1h45m over gigabit lan. Thanks for all your help.

10-31-2007, 11:04 AM
Great: glad you got it done.