Use Time Machine's Command-Line Utility to Measure Backup Changes

Terminal and tmutil will tell you about Time Machine's drift rate

Use Time Machine's Command Line Utility to Measure the Changes in Each Backup

Time Machine is your Mac's built-in backup system, which automatically backs up all your files effortlessly and easily. But some users need more feedback than Time Machine typically offers, such as data about drift. Drift tells you how much data has been added to or removed from your backup. This is helpful if you're deciding whether or not to increase your backup storage size.

Fortunately, Time Machine is built on top of a command-line utility called Terminal that can tell us everything we need to know to measure drift. Here's a look at how to use Terminal and the tmutil command to measure the changes that occur between one backup and the next.

The information in this article applies to the Time Machine backup system software for Macs on Mac OS X Leopard or later.

Why Is Drift Information Helpful?

There are many reasons users want to know the drift rate. If you measure drift and discover you're adding large chunks of data each time you run a backup, it may be time to buy a larger backup drive. On the flip side, you may discover that your current backup drive is much larger than you need, now or in the foreseeable future.

Time Machine's user interface doesn't include a method for measuring drift. While it's possible to measure the amount of data stored on your backup drive before and after Time Machine runs, you'll see only the total amount of change, not specifically how much data was added and how much data was removed.

This is where Terminal and the tmutil (Time Machine Utility) command come into play.

Use Terminal and Tmutil to Measure Drift

Terminal's tmutil command allows you to set up, control, and interact with Time Machine. Anything you can do in Time Machine's user interface, you can also do with tmutil, but tmutil allows much more functionality. Here's how to use Terminal and tmutil to measure drift.

  1. From the Finder, select Go > Utilities. (Alternatively, go to Applications > Utilities, or select Spotlight Search and enter Terminal.)

  2. Double-click Terminal to launch the utility.

  3. To find out where the Time Machine directory is stored, enter the following command in Terminal's command-line prompt and then press Return or Enter.

    tmutil machinedirectory
  4. Terminal will display the current Time Machine directory.

  5. Highlight the directory pathname Terminal gives you.

  6. Go to Terminal's Edit menu and select Copy or Command+C.

  7. Now that you've copied the Time Machine directory to the clipboard, return to the Terminal prompt and enter the following, but don't hit Return or Enter yet:

    tmutil calculatedrift

  8. Add a space after the above text and then add a quote ( " ).

  9. Paste the Time Machine directory pathname from the clipboard by either selecting Paste from Terminal's Edit menu or pressing Command+V.

  10. Add a closing quote after you paste the directory name. Here's an example of what it might look like. Your directory pathname will be different, of course.

    tmutil calculatedrift "/Volumes/Tardis/Backups.backupdb/CaseyTNG"

    Surrounding the directory pathname with quotes will ensure that if the pathname contains any special characters or spaces, Terminal will still understand the entry.

  11. Press Return or Enter.

  12. Your Mac will start analyzing your Time Machine backups to produce the drift numbers, specifically, the amount of data added, the amount of data removed, and the amount changed. It will provide numbers 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.

Reading and Understanding Drift Calculations

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. Here's an example:

Drift Averages
-------------------------------
Added: 1.4G
Removed: 325.9M
Changed: 468.6M

Don't use only the average drift to make decisions about storage upgrades. It's important to look at the drift data for each time slice. Your drift measurement will likely show that more data gets added to a backup than gets deleted, so a larger backup drive may eventually be necessary.