12

Let's say I have a particular folder, that has never changed, in the first backup, eg my MP3 music collection from 2009. (I know my important files should be saved elsewhere, but it's just an example).

In one scenario, I deleted the folder, and in another, the folder is still in my home folder.

I dont understand what this means: The oldest backup are deleted when your disk becomes full.

Does it means that when there is not any space left on the drive, Time Machine will start deleting my music ?

Obviously if there is no more space left and Time Machine wants to backup new files, it has to delete something. But what exactly does it delete ?

15

Roughly speaking, Time Machine deletes files in the same order you do. (The roughly speaking part has to do with it deleting hourly backups even when there are older daily backups, and daily even when there are older weekly backups.)

For example, suppose you create a file in January and delete it in July, and TM is backing up all this time. TM will first see and back up the file in January. From then until you delete the file in July, every time TM does a backup it notices that you have the file but it's already backed up, so it doesn't copy it again. It does, however, put it into every single one of those snapshots. How it does that without copying the file again is fascinating but not important here. The point is, the file is in every one of those snapshots, and won't be deleted until all of them are. Unless you're micro-managine TM, that won't happen until the disk is so full that TM has had to delete everything thru July.

Another way to say it: Even though it copied the file only once, it saw it many times, and won't delete it as long as it remembers any of those sightings.

More precise rules:

Time Machine does not backup any file it has never seen. (Duh!) If you create a file and immediately delete it, before TM takes its next snapshot, it doesn't get backed up. This can be summarized as If you don't keep it, neither does TM.

Time Machine defines an hourly backup as any snapshot that is not the first snapshot of its day. It deletes it when it is 24 hours old, or when you've used "Backup now" to force 24 newer hourly backups after it. If you create a file, keep it around until TM takes at least one snapshot (let's call it an hour) but delete it later that same day (or at least before the first snapshot of the following day), TM will keep it for 24 hours. This can be summarized as If you keep it for an hour, TM keeps it for 24 hours.

Time Machine defines a daily backup as the first snapshot of a day that is not also the first day of the week. TM will keep it for a month. This can be summarized as If you keep it for a day, TM keeps it for a month.

Time Machine defines a weekly backup as the first snapshot of the week. Rather than get into a religious war about when a week begins, TM defers the decision of whether a snapshot is a daily or a weekly backup until the snapshot is at least a month old. Until then, it doesn't matter, because it'll keep it either way. When a snapshot becomes more than a month old, if there is another snapshot less than 7 days prior, then the newer one is a daily backup, and gets deleted. Otherwise it's a weekly backup and gets retained. This can be summarized as If you keep it for a week, TM keeps it until the disk is full.

By the above rules, your initial backup is therefore on the first day of its week, no matter what day that is. Successive "weeks" will be at least 7 days long, and may be longer if you don't let TM make regular backups.

TM is in effect watching what you do with the file to see how aggressively it should preserve it. The longer you keep it before deleting it, the longer TM keeps it before deleting it. Your actions give TM guidance how to put your files into one of four classes: files you deleted before TM saw them, files you deleted before the next day's first snapshot, files you deleted before the next week's first snapshot, and files you kept across a weekend. These groups have successively longer retention periods, matching the fact that they contain files you kept for successively longer times before deleting them.

In each group, TM backs up the files in the same order you created them, and deletes them in the same order you deleted them.

TM never deletes your only snapshot. If it has deleted all but one snapshot to make room, and still does not have enough, it will abort the backup. It's better to have an old backup than none at all. This can be summarized as If you never delete it, neither will TM.

  • Thanks for the answer. There seems to be a lot of misunderstanding about what files can be deleted, and when.. – alecail Jan 3 '15 at 23:28
  • 2
    Is this documented by Apple somewhere ? – alecail Jan 5 '15 at 10:19
  • 1
    Not that I know of. When TM was first introduced I spent a LOT of time digging into it, poking and prodding to discover exactly how it worked. Some details, like exactly what happens when a snapshot reaches age one month, required month-long experiments. Apple seems to think nobody cares about the details. I think they're wrong. It's a beautiful and elegant algorithm, and deserves a better description than just "it works". – ganbustein Jan 5 '15 at 11:17
  • Actually, this is documented! support.apple.com/en-us/HT201250#backup – SilverWolf Jun 14 '18 at 22:54
13

Time Machine will always keep a backup of the current state of the contents of the source volume. When the backup drive becomes full, it will start removing the oldest backup states to make room. If the contents of a folder have not changed, it will retain all the contents. If the contents of the folder changed over time, it will remove the oldest content state. So in your example, if you had deleted some MP3's from that folder after the first Time Machine backup and Time Machine had to delete a backup to make room for a current backup, you would no longer be able to recover those deleted files.

You must log in to answer this question.

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