Remove unnecessary backups from TimeMachine to get space
Solution 1:
I use this article to help me in deleting files from Time Machine:
- http://www.tech-recipes.com/rx/2655/time_machine_delete_files_folders_from_backup/
It talks about removing all the backups of a single file, maybe it's not what you're looking for, but it definitely could resolve the first issues (Lightroom previews). In practice, it's easier to delete all backups of one file or all files in one backup than it is to go in and remove only one file from one backup.
Here's a brief summary of that article:
- Open Time Machine
- Select the folder/file you want to delete from your backups
- Through the "option" menu in the Finder menu bar (ctrl-click is not available in TM, don't know why) select "Delete all backups of selectedfile", where selectedfile is (obviously!) the file you selected.
Solution 2:
You can simply enter Time Machine and select folders, apps, and files and select to delete all backup copies of that item. The command line tmutil compare
also gives exhaustive detail of what changed between backup intervals if you don't mind using the terminal and a UNIX shell. Even without shell tools, you can micromanage storage from the Time Machine GUI as follows - quoting Apple's article on Mac Basics: Time Machine:
You can also enter the Time Machine restore interface and find files that can be removed from the backup drive itself to conserve space. To do this, select the file(s) and from the Action pop-up menu (gear icon) in the Time Machine Finder window choose "Delete All Backups of...". Be sure to only delete files you are sure you won't need or want to restore later.
Next, you can use a tool like BackupLoupe to analyze your Time Machine backups to identify how much space each interval used, how much space your average backup takes, how long it will be to fill the drive at the current rate, etc…
With that level of detail, you can curate your storage needs as little or with as much detail as the situation requires. This tool has helped me figure out problematic backup drives, Macs with filesystem corruption (when each backup is larger than it should, etc…) Once you have visibility on what's being stored, you can delete folders, entire snapshots and configure your backup exclusion lists to be in harmony with your available storage and backup needs.
Solution 3:
If you want to delete a backup from a certain date, there is a solution for that. I saw it from this screencast:
- Go to the time machine icon on the menu bar, click enter time machine.
- After your desktop goes into the stars animation, you should be able to see a list of dates of your backups on the right.
- Go to the backup date that you want to delete
- In the middle, click the gear icon and click Delete Backup.
- Type your password when prompted
Solution 4:
I wrote a bash script to delete all the backups but the latest since the ones posted elsewhere didn't work for me. I know you didn't want to specifically do that, but it can be modified to keep more backups (see below). Please not that this does not apply to deleting specific folders or files from backups. This script assumes that you have it on a local hard disk (an external disk, most likely). I had to write my own because the backups are not associated with this computer, so tmutil listbackups
doesn't work, and that's what other scripts depended on.
In the scripts below, replace DISKNAME
with the name of the hard disk with the Time Machine backups and COMPUTERNAME
with the name of the computer that the backups belong to.
First, run this script to see a list of the backups the script will delete:
while read line; do
echo "/Volumes/DISKNAME/Backups.backupdb/COMPUTERNAME/${line}"
done < <(ls /Volumes/DISKNAME/Backups.backupdb/COMPUTERNAME | tail -r | tail -n +3)
The +3
will make leave the last backup. If you want to keep the last two backups, make it +4
. To keep the last three backups, +5
, and so on.
To delete all of the backups except the latest, run this script:
while read line; do
sudo tmutil delete "/Volumes/DISKNAME/Backups.backupdb/COMPUTERNAME/${line}"
done < <(ls /Volumes/DISKNAME/Backups.backupdb/COMPUTERNAME | tail -r | tail -n +3)
I know it could be made fancier by defining variables and stuff, but to be honest, I'm not that well-versed in shell scripts. I just know the other super-complicated ones didn't work, but this one did for me, so here it is for posterity.
Solution 5:
I've written a shell script that lets you optionally specify the number of days to keep: all the backups older than the specified number of days (from now) are deleted.
You can check it out on its GitHub repository.