0

From How can I manually delete old backups to free space for Time Machine? it is possible to delete an entire Mac's backups, or specific folders by date from Terminal.

Entire Mac…
sudo tmutil delete /Volumes/drive_name/Backups.backupdb/mac_name
By date…
sudo tmutil delete /Volumes/drive_name/Backups.backupdb/mac_name/YYYY-MM-DD-hhmmss

To delete one specific file or folder throughout the entire history, received wisdom is to right click inside "Enter Time Machine" & 'Delete all backups of…'

enter image description here

This, however, appears to do nothing at all. In this particular instance, Time Machine, in its infinite wisdom has at some point in the past year decided Downloads is now Downloads 1.
Switching off Automatic Updates & adding the Downloads drive to the exception list removed one copy, but only in newer backups. It has left the rest of the history intact, from the beginning, right through when it first decided there were two Downloads drives, a year ago. These versions therefore appear to be orphans. They don't belong to any current drive.

This has now left the entire history with a name change half-way through.
Setting it to 'delete all' from both the first date [Jun 2021] & latest date now changes nothing at all. [I understand this is only triggered when you Cancel back out of Time Machine & may take some time. I gave it 4 hours, nothing appears to have changed.]

So, I'm left with trying to see if I can persuade tmutil to deal with it. Not the entire Mac, & not one date at a time - there are 100 individual backup instances in the history. Usually when Time Machine fails [which it does with alarming propensity], the only recourse is to erase the entire drive & start over. It would be nice, for once, to not have to do this.

3
  • "Usually when Time Machine fails [which it does with alarming propensity],...." TM would be more robust if you were to update to APFS backup disk. (But you probably know this).
    – Gilby
    Commented Aug 16, 2022 at 4:21
  • I don't have HFS TM, but I believe HFS tmutil accepts wild cards like tmutil delete /Volumes/drive_name/Backups.backupdb/mac_name/2022-0*/Downloads\ 1
    – Gilby
    Commented Aug 16, 2022 at 4:26
  • @Gilby - to use APFS I would also need to be running Big Sur… which I can't. Therefore, Mojave & HFS it must be.
    – Tetsujin
    Commented Aug 16, 2022 at 8:37

1 Answer 1

1

Thanks to Gilby in comments, it's true that tmutil can use wildcards, which felt like it ought to make the task easier.
However, I realised during this investigation that tmutil gives an error Invalid deletion target (error 22) when asked to delete an individual 'drive folder' from inside any backup 'date'.

As to why this may be, this post on MacRumors started me in the right direction

The man page for tmutil says: " delete path ... Delete one or more snapshots, machine directories, or backup stores."

I believe that the path you gave was none of those three things. In your path, I think "Backups.backupdb" is a backup store, "MacPro" is a machine directory, and "2018-11-26-201925" is a snapshot. If I understand the man page, you want to delete what is called a backup source -- and apparently the tmutil delete verb won't work on that.

So, tmutil will simply not work for this purpose.

It's long been known that trying to use Finder or rm to delete files in Time Machine causes all sorts of permissions errors. I discovered a 'get out of jail free card' in the form of the Time Machine Safety Net helper, bypass. Source: Super User - How can I delete Time Machine files using the commandline
This apparently ignores all those special permissions Time Machine uses to protect itself, allowing you to dive right in & delete things without any safety net.

bypass isn't a part of the usual bash toolkit, so you have to address it by full path in order to invoke it. Since Yosemite, it's in
/System/Library/Extensions/TMSafetyNet.kext/Contents/Helpers/bypass

So, to delete all instances in all folders, you need
sudo /System/Library/Extensions/TMSafetyNet.kext/Contents/Helpers/bypass rm -rf /Volumes/[volume_name]/Backups.backupdb/[computer_name]/*/[target_folder]

Success!

1
  • Glad you got there. And you would be annoyed with TM to APFS which does not any fine grained deletion!
    – Gilby
    Commented Aug 16, 2022 at 9:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .