in Backup, How To's, macOS

There might come the time when you might want to cleanup your Time Machine backups, here’s how you can do it. If you want to remove the entire backupset you might want to simply remove and erase the storage volume, but if you want a bit of more control over the process you can try using Terminal to remove the oldest backup entries.

If you want to remove specific files from the backup, access Time Machine directly and remove the file/folder by using the context menu option.

First Steps

Deactivate automatic Time Machine backups first, using its interface (untick the checkbox below the large Time Machine icon).

To do that, first open Terminal on your Mac and verify to which volume is Time Machine linked to by issuing ls -l /Volumes. There should be a “/Volumes/Time Machine Backups” entry or something to that effect:

[code]ls -l /Volumes
total 0
drwxr-xr-x 6 root wheel 476 12 Fev 14:36 Time Machine Backups
lrwxr-xr-x 1 root wheel 1 3 Jul 12:50 Macintosh HD -> /
drwxr-xr-x+ 3 root wheel 96 15 Jul 17:52 com.apple.TimeMachine.localsnapshots[/code]

Then you’ll need to list your current backup records, by issuing:

sudo tmutil listbackups /Volumes/Time\ Machine\ Backups/

Note: use the TAB key to fill in the folder mount name after typing the first few letters (e.g. “(…)/Tim”->TAB)

[code]/Volumes/Time Machine Backups/Backups.backupdb/MyMacBook/2018-07-02-002959
/Volumes/Time Machine Backups/Backups.backupdb/MyMacBook/2018-07-02-031051
/Volumes/Time Machine Backups/Backups.backupdb/MyMacBook/2018-07-03-014836
/Volumes/Time Machine Backups/Backups.backupdb/MyMacBook/2018-07-03-031815
/Volumes/Time Machine Backups/Backups.backupdb/MyMacBook/2018-07-11-032147[/code]

You see a list of folders all named after a timestamp such as the example above. All list entries start with the Time Machine volume mount folder, followed by a database folder (e.g. “Backups.backupdb“, the device name (i.e. your Mac’s network id), and the timestamp, in a Year-Month-Day-Time format (“2018-02-15-140503”).

Removing Timestamped Backup Entries

In order to remove a part of a Time Machine backup you’ll need to single out one of these timestamp folders. But you can also use wildcards for this and remove, e.g. all records from a year (“2017*” or a month “2018-01“), like so:

Advertisement

sudo tmutil delete /Volumes/Time\ Machine\ Backups/Backups.backupdb/MyMacBook/2017*

tmutil will then start removing all entries and output the corresponding space:

[code]Deleting: /Volumes/Time Machine Backups/Backups.backupdb/MyMacBook/2017-09-04-111540
Deleted (30.8G): /Volumes/TimeMachine Backups/Backups.backupdb/MyMacBook/2017-09-04-111540
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/MyMacBook/2017-09-18-131513[/code]

You might opt for just erasing those folders instead of using tmutil, but the advantage here is that by doing it in this way, Time Machine’s database is properly updated, whereas it might break. This way won’t be fast but it will be done properly.

Compacting [and freeing up] Used Drive Space

Finally, after removing the entries, you should compact the sparsebundle image where Time Machine records are being stored. You’ll probably need to use DiskUtil to unmount the currently loaded Time Machine volume and then mount the drive where the corresponding sparsebundle image file is.

Issue sudo hdiutil compact /Volumes/TimeMachineDrive/TimeMachineBackups.sparsebundle and by then the previously occupied space should make itself a lot more evident.

Advertisement