How do I trim my Time Machine backups and find and exclude frequently-updated large files from bloating it?

14

8

Time Machine is nice because it Just Works and it does its magic in the background. But left to itself, it can really swell up due to either large files that you don't really need backed up slipping in and frequently-changing files you don't really need every version of.

How can I

  1. Remove files from backups?
  2. Find and exclude files that I don't want backed up (e.g. frequently changing ones)

adambox

Posted 2010-02-20T21:34:50.260

Reputation: 905

wow, you guys are fast. I posted this so I could post my own answer but I took too long! ;) – adambox – 2010-02-20T21:47:52.717

wanna select a best answer? – finiteloop – 2010-02-20T23:22:03.013

I'm going to try out Disk Inventory X tonight. Sorry I'm slow – adambox – 2010-02-22T15:45:39.900

Answers

8

Remove backups

You can remove files from backups by viewing the enclosing folder in the Finder, then enter Time Machine. Find the file or folder, right/control-click and choose either delete that backup, or delete all backups (versions) of the file. (See this answer)

Find and exclude files

The best way I've found to hunt down and remove files from backups is this:

  1. Use GrandPerspective to scan your backup of your drive. If you backup your main disks to a drive called "Backup Drive", then scan Backup Drive/Backups.backupdb/Yourcomputername
  2. GrandPerspective will show you a nice graphical representation of disk usage, showing every copy of each file on the backup, so if you have a huge 5 gig file that's changed 5 times, you'll see 6 big blocks. Find these repeat offenders, starting with the biggest blocks you see.
  3. For each one
    1. Exclude it from future backups: Open the Time Machine pref pane in System Preferences and click Options. Click the plus and navigate to the offending file/folder on your actual drive (not the backup drive)
    2. Nuke it from all backups per the instructions above ("Remove backups")

What to exclude

This answer suggests some stuff you might want to exclude. Some more good stuff to exclude that I found using GrandPerspective:

  • ~/.dropbox (this is where dropbox keeps its internal DB, which can get HUGE if it caches versions of old files)
  • Some people exclude their Dropbox directory because it keeps revisions on its server, but I let Time Machine do it too for extra redundancy and control.
  • Your Downloads folder (mine's in dropbox anyway)
  • Folders where importers put things that you move every time, e.g. Easy VHS to DVD conversions, imports of movies from my Flip video camera, etc.
  • Music/Podcasts (these eat up a lot of space and for most I can get back-episodes if I need, plus I never want to :P)
  • ~/Library/Application Support/SyncServices omg this changes everytime you sync. I had a gajillion copies on my Time Machine drive
  • /Library/Updates the OS likes to keep copies of the packages from automatic updates. Why? who knows but you don't need 'em UAYOR: there's probably a reason Apple doesn't exclude them, so a full restore might be more of a pain if you do this

adambox

Posted 2010-02-20T21:34:50.260

Reputation: 905

haha I didn't even realize this was your own answer – finiteloop – 2010-02-20T21:56:52.213

1No, I wouldn't want to exclude my whole Dropbox. Why rely on external backups when you've got Time Machine at your fingers? And to ensure you make GrandPerspective see ALL files, you might need to run it as root. – Arjan – 2010-02-23T14:29:01.293

And if /Library/Updates is being written to the backup, then I guess Apple has a reason for that, as Time Machine does explicitly exclude many non-required files (see http://superuser.com/questions/71824/does-apples-time-machine-app-really-copy-everthing). Maybe it's better to keep them around when doing a full system restore?

– Arjan – 2010-02-23T14:43:58.507

my feeling is that I can always get updates again. That's why I don't keep the installers for most free programs I get off the web either. meh, personal preference – adambox – 2010-02-23T18:53:21.633

1

I'm accepting this answer because Disk Inventory X (http://superuser.com/questions/111363/111364#111364) crashed when it tried to scan my Time Machine drive. I think the hardlinks the OS uses in the backups fooled it into thinking each backup version was an entire disk so it kept scanning and scanning and scanning. GrandPerspective knows about the hardlinks

– adambox – 2010-02-24T13:44:20.740

Entourage is a good candidate for exclusion. It generates a large backup database which changes every time you get an e-mail message. – alimack – 2010-03-01T15:54:45.743

GrandPerspective worked for my use case as well (lots of hard links; disk utility says ~20M files in the TM backup). However, GrandPerspective did crash when I tried to save the scan result to disk, so just FYI for anyone else that uses GrandPerspective on a large TM backup, and tries to save the results to disk before using them... – Clayton Stanley – 2013-12-12T00:07:43.327

5

To find the files that may be too large, or unnecessarily backed up, I use Disk Inventory X, an application that scans your current hard drive contents and gives you a visual representation of the files on your HD as well as the space they are taking up. (I've used with Leopard and Snow Leopard)

Once you identify any files as ones you don't want a bunch of back-ups of:

  1. connect your time machine backup drive
  2. click on the time machine logo in the menu bar
  3. select "Enter Time Machine"
  4. navigate to and select those files/folders in the Time Machine window
  5. click on the gear menu icon
  6. select "Delete all backups of

Time Machine will prompt for your password and delete all of the backups of the file/folder. You can then exclude these files/folders from future backups. To do so:

  1. go to the Time Machine preference pane in the System Preferences
  2. click "Options..."
  3. add the file/folder you wish to exclude from future backups

Note: Files such as sleepimage are system files, and removing from backup could cause unexpected behavior if you ever need to restore your system from a Time Machine Backup. sleepimage is a file that is the size of the amount of memory in your computer. Actually, I'm not even sure that Time Machine backs up this file. The moral: dont delete system files from your Time MAchine backup, use this method only for your personal files such as your iTunes Media folder or your iPhoto Library. Also, files which I exclude from backups I make sure to keep my own personal backup on a different hard drive.

finiteloop

Posted 2010-02-20T21:34:50.260

Reputation: 1 743

+1 way better than my answer lol. Thanks, this Disk Inventory X looks amazing! – Sam – 2010-02-20T21:45:25.780

@Nextraztus yeah its really helpful. – finiteloop – 2010-02-20T21:50:22.163

To ensure you make Disk Inventory X see ALL files, you might need to run it as root. Instructions at http://serverfault.com/questions/9422/what-is-time-machine-doing/39310#39310 (Time Machine does not backup the sleep image; see "Does Apple’s Time Machine app really copy everthing." at http://superuser.com/questions/71824/does-apples-time-machine-app-really-copy-everthing)

– Arjan – 2010-02-23T14:29:42.273

The problem with this method is that you're only finding files that are large on your main drive, not files that are large AND are backed up multiple times on your Time Machine drive (i.e. they change a lot). You can use GrandPerspective on the TM drive (http://superuser.com/questions/111363/111367#111367), but DIX was crashing for me when I tried it on the TM drive

– adambox – 2010-02-24T13:42:49.823

2

  1. Enter Time Machine
  2. Browse to the large file(s) in question.
  3. Ctrl+Click/Right-Click on them, go to 'Delete all backups...' option.
  4. It will need admin privs, escalate.
  5. Do this for all your files.

Now, go to the TM Preferences, click on the "Options" button. Add the files to your exclusions list.

Sam

Posted 2010-02-20T21:34:50.260

Reputation: 848

1

Remove files from backups-

Locate the backup or item you want to delete via the Timeline or "cascade" of Finder windows. If you want to delete all backups of a particular item or items, select it/them in the window. Right-click the item (if you're on Leopard, click the "gear" icon in the toolbar) and select either Delete Backup (the entire backup) or Delete all Backups of in the small menu that appears.

Exclude files ,which you don't want to backup:- you should simply go into System Preferences, choose Time Machine, click on Options, and then add every folder EXCEPT /Users from the root level of your hard drive.

user185532

Posted 2010-02-20T21:34:50.260

Reputation:

0

create a perl script: The example below will delete all backups (add some logic to only remove the ones you want to within the loop:

@a = `tmutil listbackups`;
@a = sort(@a);
foreach $i (@a) {
print "BUP: $i \n";
chomp $i;
   #here's where you could put some logic to not delete all
  system("tmutil delete $i")
}

Save this as something.pl. Run it like this:

sudo perl <Script>

Enter your password and it will automatically remove all backups.

Ben

Posted 2010-02-20T21:34:50.260

Reputation: 1