Removing all stale backups
Jun. 4th, 2016 07:34 pm
My initial attempt to remove the files with a naive sudo rm -Rf Backups.backupdb failed with a whole slew of operation not permitted errors. Investigating further, I found the ACLs on the directory were configured to prevent the casual removal of the directory — an eminently sensible precausion.
A quick google revealed a solution to the problem: the Time Machine bypass command. The location varies depending on the release of OS X, but when the command is used as a prefix to the remove, i.e.
sudo /System/Library/Extensions/TMSafetyNet.kext/Contents/Helpers/bypass rm -Rf Backups.backupdb
it allows rm to ignore the ACLs and allowed me to blow away the entire backup directory with a single command — something that freed up 900GB of space and maybe 100 million inodes.
It's worth noting that the only reason I was able to use bypass rm rather than the officially approved tmutil delete was because the backup directory was stale and no longer in use. Using rm on an active Time Machine database has the potential to screw up the hard links used to build the individual backup images.