Time Machine's Command Line Utility Measures Backup Changes

Discover How Much Data is Added to or Removed From Your Backups

Use Time Machine's Command Line Utility to Measure the Changes in Each Backup
One feature that Time Machine users commonly ask for is information about drift, which is a measure of the change that occurs between one backup and the next. Screen shot courtesy of Coyote Moon, Inc.

Time Machine is the backup method of choice for many Mac users. But there are a couple of things missing from Time Machine: information about what's going on during a backup, and information about the current state of the backups.

Most of us believe our backups are in good shape. We also tend to blithely assume that we have sufficient drive space for the next backup. After all, one of the things Time Machine does is remove old backups if it needs room for new ones.

So, there shouldn't be any problems, or at least, we hope not.

Don't get me wrong; I like Time Machine. It's the primary backup method on every Mac in our office and home. Time Machine is simple to set up. Even better, it's transparent to use. We know that if disaster strikes and we lose a drive's worth of data, we won't hear anyone say that the last time they ran a backup was a week ago. With Time Machine, the last backup probably ran no more than an hour ago.

But this reliance on an automated process that delivers very little usable feedback can be a concern if you support two or more Macs and you need the ability to plan for such things as when to increase backup storage size.

Drifting Along: How Much Change Occurs to the Backup Over Time

One feature that Time Machine users commonly ask for is information about drift, which is a measure of the change that occurs between one backup and the next.

Drift tells you how much data has been added to your backup, as well as how much data has been removed.

There are many reasons to want to know the drift rate. If you measure drift and discover that you're adding large chunks of data each time you run a backup, you may want to plan on a larger backup drive in the near future.

Likewise, if you notice that you're removing copious amounts of data with every backup, you may want to determine whether you're saving enough history in your backups. Once again, it may be time to buy a larger backup drive.

You can also use drift information to help you decide whether you need to upgrade a backup drive at all. You may discover that your current backup drive is much larger than you need, now or in the foreseeable future. If the added data rate per Time Machine slice is low, you have less reason to consider an upgrade than if the added data rate is high.

Measuring Time Machine Drift

Time Machine's user interface doesn't include a method for measuring drift. You could measure the amount of data stored on your backup drive before Time Machine runs and then again after it runs. But that only reveals the total amount of change, not how much data was added and how much data was removed.

Thankfully, like many of Apple's system utilities, Time Machine is built on top of a command line utility that has the capability to provide all the information we need to measure drift. This command line utility is one of our favorite apps: Terminal.

  1. We'll start by launching Terminal, which is located at /Applications/Utilities.
  1. We're going to use the tmutil (Time Machine Utility) command, which allows you to set up, control, and interact with Time Machine. Anything you can do with the GUI version of Time Machine, you can do with tmutil; you can also do much more.

    We're going to use tmutil's ability to calculate drift in order to view the information we need. But before we can issue the appropriate command, we need another piece of information; namely, where the Time Machine directory is stored.

  2. In Terminal, enter the following at the command line prompt:
  3. tmutil machinedirectory
  4. Press return or enter.
  5. Terminal will display the current Time Machine directory.
  1. Highlight the directory pathname that Terminal spits out, then click Terminal's Edit menu and select Copy. You can also just press the command + C keys.
  2. Now that you've copied the Time Machine directory to the clipboard, return to the Terminal prompt and enter:
  3. tmutil calculatedrift
  4. Don't press enter or return just yet. First, add a space after the above text and then a quote ("), then paste the Time Machine directory pathname from the clipboard by either selecting Paste from Terminal's Edit menu or pressing the command + V keys. Once the directory name is entered, add a closing quote ("). Surrounding the directory pathname with quotes will ensure that if the pathname contains any special characters or spaces Terminal will still understand the entry.
  5. Here's an example using my Mac's Time Machine directory:
    tmutil calculatedrift "/Volumes/Tardis/Backups.backupdb/CaseyTNG"
  6. Your Time Machine directory pathname will be different, of course.
  7. Press return or enter.

Your Mac will start analyzing your Time Machine backups to produce the drift numbers we need, specifically, the amount of data added, the amount of data removed, and the amount changed. The numbers will be provided for each slice or increment that your Time Machine stores. These numbers will be different for everyone because they're based on how much data you store in the backup, and how long you've been using Time Machine. Typical slice sizes are per day, per week, or per month.

It can take some time to run the drift calculations, depending on the size of your backup drive, so be patient.

When the calculations are finished, Terminal will display drift data for each Time Machine backup slice in the following format:

Start date - end date

-------------------------------

Added: xx.xx

Removed: xx.xx

Changed: xx.xx

You will see multiple groups of the above output. This will continue until the final average is displayed:

Drift Averages

-------------------------------

Added: xx.xx

Removed: xx.xx

Changed: xx.xx

For example, here's some of my drift information:

Drift Averages

-------------------------------

Added: 1.4G

Removed: 325.9M

Changed: 468.6M

Don't use just the average drift to make decisions about storage upgrades; you need to look at the drift data for each time slice. For example, my largest addition occurred one week when I added nearly 50 GB of data to the backup; the smallest addition was 2.5 MB of data.

So, what did the drift measurement tell me? The first drift measurement was from last August, which means I'm storing about 33 weeks of backups on my current backup drive. On average, I add more data to a backup than I delete. Although I still have some headroom, someday soon Time Machine will start reducing the number of weeks of information it stores, which means a larger backup drive may be in my future.

Reference

Manpage tmutil

Published: 3/13/2013

Updated: 1/11/2016

Was this page helpful?