View Full Version : Ejecting SparseBundle After Backup

09-23-2009, 05:38 PM
This is a really two questions, I suppose, but I'm trying to write a post-backup script that will automatically compact my sparsebundle files. I have two scheduled backups that I run. One runs Monday, Wednesday and Friday evenings and the other Tuesday, Thursday and Saturday evenings. I store them on a smallish external hard drive, so I find myself having to compact regularly.

I have a short Ruby script that now does this, but it runs before the volume is ejected so only one of the two volumes can actually be compacted and the other one - the mounted one - throws an error. I'd like to eject the now completed volume before running the script. Is that possible?

On a related note, I see the new 2.6.x options to eject mounted volume, etc. and maybe that's the way to do it, but I can't find a way to enable these options. They're disabled for me no matter what I try.

I've deleted and rebuild my schedule line items several times, but I still can't activate those options.

Any thoughts would be appreciated.

09-23-2009, 05:41 PM
A sparse bundle is automatically ejected on completion. You'd need to toss your script in the background, wait for the unmount, then compact -- something like

nohup /bin/bash -c "sleep 90; diskutil compact path-to-bundle" &

09-23-2009, 05:48 PM
A sparse bundle is automatically ejected on completion.

Ah, okay. That explains why some options are disabled. If they're unnecessary, I guess it makes perfect sense.