Efficiently and Safely Deleting or Un-Trashing Time Machine Backups

7,521

Solution 1

It is my understanding now that all Time Machine backups after the initial one are a diff of the previous backup, not a disk image. So deleting these folders would render subsequent backups useless (I think).

Fortunately that is not the case. Time Machine backups are complete backups, but they share the disk space with previous backups for the files that have not changed (using hard links). As long as any of the hard links is available, you can access the file.

So if you have a big file in Monday's backup, and the file has not changed on Tuesday, the same file will exist in Tuesday's backup as well, but it will not take up any extra disk space. You can safely delete Monday's backup, and the "copy" for Tuesday will continue to work.

The "Preparing to empty the Trash ... Items to delete: [number]" dialogue got up to 1.5 million files(!) before I stopped it. And I don't have permission, even as root, to rm -rf them.

Yes, because of these hard links, there is an insane number of files in a Time Machine backup (they are all counted so many times). You cannot use simple file-based tools on a Time Machine backup, you need something that understands (and preserves) the hard links. For example, if you tried to copy all the files on a Time Machine disk you would end up with huge duplication. The only way to copy/backup a Time Machine is cloning the disk structure (using something like Disk Utility).

Solution 2

I had luck solving this problem by logging in as root:

su

and then typing this in terminal:

cd /Volumes/<name of your drive>/.Trashes

then you can do an

ls -la

which will show you the name of the trash directory (in my case 501) which I then deleted using this command

rm -rf 501

which, like the finder 'Empty Trash' command, takes a while, but at least it doesn't screw up and hang forever. Plus, this has the added benefit of NOT having to reformat your drive.

Originally Posted by auralox

Solution 3

Well, first off, for future reference on a better way to clean up files on a Time Machine Backup, see this thread: How do I trim my Time Machine backups and find and exclude frequently-updated large files from bloating it?

Now, as far as your current situation, if your attempt to empty the trash already removed some files, any damage is probably already done. Anything that is still in the trash, you might be able to go and un-delete them. If you are using Leopard, you will need to do this manually, but if you are using Snow Leopard you can go into the trash, select all of the files, control click them and select "Put Back".

Once you have reversed the damage as much as possible, I would click on Time Machine in the menu bar and try selecting enter time machine. See what it shows you. Poke around and see if your old stuff is still there.

I don't really know of a good way to reverse what has been deleted, some other users might. It may end up being that the damage you did seems to not be a huge deal, and probably by running subsequent backups you would be alright. I guess it would be worth a shot.

Personally, if it was me and nothing on the backup was too dire, I would probably buy a new disk, backup using that until I hadn't accessed the current one is x amount of time and then erase and use the old one. You may prefer not doing that though.

Solution 4

Wow ... on a lark, I tried just moving the folders back to their original location (using the finder) and it worked. I don't know what was different from previous attempts. Anyhow, thanks for your help @segfault. I believe I'm good to go -- Time Machine lets me browse old backups -- and I no longer have a Trash too big to empty.

Share:
7,521

Related videos on Youtube

Admin
Author by

Admin

Updated on September 17, 2022

Comments

  • Admin
    Admin over 1 year

    I have been storing my Time Machine backups on an external drive. Noticing that space was getting low, I viewed that external drive in the Finder, selected a bunch of the folders and moved them to the Trash.

    I now realize this was stupid of me, for a number of reasons:

    • Time Machine will delete old backups properly, when it's running low on space.
    • It is my understanding now that all Time Machine backups after the initial one are a diff of the previous backup, not a disk image. So deleting these folders would render subsequent backups useless (I think).
    • The "Preparing to empty the Trash ... Items to delete: [number]" dialogue got up to 1.5 million files(!) before I stopped it. And I don't have permission, even as root, to rm -rf them.
    • I also don't have permission, even as root, to mv files from /Volumes/Time\ Machine\ Backups/.Trashes/ back to their original location. I did a little reading about Access Control Lists and am wary of making yet more mistakes by fooling around with them.

    So, does anyone have insight or advice on how best to deal with this problem?

    Specifically, I am wondering:

    • Would deleting the items in the Trash render my existing Time Machine backups useless?
    • If deleting those folders currently in the Trash *is& OK, how would I do so efficiently?
    • If deleting those folders would create problems, how can I move them back to their original location?

    Thanks in advance for any help you guys can offer.

  • Admin
    Admin about 14 years
    Thanks for the quick response -- FWIW, I am using 10.5.8, not Snow Leopard. :( And yeah -- it wouldn't be the end of the world if I bought a new external disk and used that one, going forward. (Lesson learned, I guess.)
  • finiteloop
    finiteloop about 14 years
    I mean, if you KNOW you dont care about this disk, you could just wipe the current backup disk and start fresh. I guess it depends if you want the safety net of what is still good. Did you try running a backup or entering time machine to see what is missing or if that will work at all? It's possible that you just deleted the date of some particular days, but by and large your data is still there.
  • Stephen Jennings
    Stephen Jennings about 14 years
    +1 Much better explained than how I was trying to word it.
  • finiteloop
    finiteloop about 14 years
    Sorry- I couldn't figure out how to edit my last comment, "date" should read "data"
  • finiteloop
    finiteloop about 14 years
    Out of curiosity, if my answer resolved this issue, why did someone else receive best answer?
  • Christian
    Christian about 8 years
    Although the system will recreate the 501 folder, it's a special folder and you should probably just rm the contents of it. You can also just sudo instead of switching to root. sudo rm -rf /Volumes/[drive name]/.Trashes/501/*