Mac – Limit the number of versions time machine stores of particular files

backupsnow leopardtime-machine

Is there any way to limit the number of versions time machine keeps of files?

In this case, I want time machine to back up some of my Virtual Machines. However, Since VM images are very large and monolithic, using the VM results in a 25 GB file that has to be backed up in it's entirety again.

However, I do want to have at least one version of the VM backed up, as a disaster prevention measure.

Is there any way to limit the history-depth that time machine keeps for certain files? I really want the extended backup that you get of everything else. Just letting the time machine drive fill up, and lose the oldest backups to a bunch of giant VM images is not an acceptable solution

Is there any way to modify time-machine backups using the terminal? I can see using some OS X cron analog to run a script that periodically deletes extra VM backups.

Best Answer

Since you don't want no as an answer, and since Time Machine is proprietary software that you cannot modify you only have two options (don't complain, you asked for it)

  • convince Apple to implement the missing feature
  • implement your own version of Time Machine

You could modify backups from the terminal or with the Finder: backups are just directories with hard links but beware that you will most likely make them unusable by Time Machine (as Time Machine relays on the fact that the backups are as they were created).

There is a function in Time Machine "Delete all backups of" which removes backed up copies of a file. You could research if this is scriptable (Apple Script or terminal). I had no luck but seems the only way to periodically clean up a backup (with cron or similar)

You didn't specify which virtualization software you are using. If it's VirtualBox there is a workaround to reduce the size of the backed up data using snapshots: http://blog.matteocorti.ch/?p=331