1

When Time Machine starts a backup, does it somehow take a snapshot of the current state of the filesystem such that any changes made to files after the backup starts are not reflected in the backup? I'm wondering about self-consistency of Time Machine backups. Are Time Machine backups perfectly consistent?

In case it isn't clear what I'm saying, here's an example. Say I have three files in a directory, 'a', 'b', and 'c', and each of them is 100 bytes in size. I start a Time Machine backup that is going to take a considerable amount of time...let's say an hour for argument sake.

In the next few minutes after starting the backup, I delete file 'a', append new information onto file 'b' making it 200 bytes in length, and create a new file 'd'. After the backup finishes, and I go in and look at the resulting snapshot, am I guaranteed to see three files 'a', 'b', and 'c', each of 100 bytes in length, and no file 'd'? Or is there no consistency guaranteed...how each of these files is backed up is a matter of when Time Machine actually backs up those particular files?

If someone thinks that Time Machine does take consistent snapshots, I would love to have a citation coming from Apple or someone who has rigorously tested to make sure this is the case. I have a particular reason to need to rely on such behavior.

TIA for any info!

PS: I think we are all running Monterey. We certainly all could be if it made a difference. I assume we're all running standard APFS setups.

10
  • 1
    Assuming recent macOS and TM to APFS destination. Yes, snapshots are "point in time" guaranteeing file system consistency. So yes to your scenario so long as the file data was flushed to disk (e.g. by closing the files) before TM starts.. But what is your "particular reason" the you are concerned about?
    – Gilby
    Commented Oct 22, 2022 at 1:09
  • I lead a team of developers. We've had a few "incidents" recently where code was lost or mysteriously changed. I want to buy them all 4G hard drives and encourage them to have Time Machine backing up constantly. I'm not doing this myself yet. If it were just me, I wouldn't worry too much about it. But if I'm going to recommend it to others, I want to know if I can trust backups made while devs are working, or if I should tell them to defer backups to off hours when they aren't usually coding. Backups wouldn't be as valuable if you couldn't trust the consistency of a set of source files.
    – CryptoFool
    Commented Oct 22, 2022 at 1:20
  • 1
    No, I don't have anywhere that talks about TM snapshots in terms of consistency. Apple just glides over that sort of thing. I would only worry about consistency when we get to the data level (e.g. database and virtual machine) where the file system snapshot may be taken in the middle of an app writing to multiple files. The file system snapshot will be consistent (by design), but the data may not be - hence application aware backup for databases and virtual machines.
    – Gilby
    Commented Oct 22, 2022 at 2:14
  • 2
    No backup system that does not integrate with the applications running on it will offer crash consistent, or database consistent backups, even if based on snapshots. There will always be some data in memory not in the backup. TM is not designed to integrate with applications, unless the applications wish to do it themselves I suppose, by offering a facility to initiate a TM backup after saving data / documents or reaching a database checkpoint. I used to work with databases and backups, and the application always did the scheduling and used an API to the backup software for consistency. Commented Oct 22, 2022 at 11:46
  • 2
    On top of that we did offsite replication to our backup datacenter. Even then, recovery by failover isn't quite up-to-the-second consistent, but certainly quicker than a tape restore, and certainly within the acceptable limits of the application owners, who had paperwork mechanisms in place to roll forward. Tested many times with complete satisfaction! At the end of the day, TM is a consumer oriented point-in-time backup, and perfectly satisfactory for most cases. Anything more complex requires a more robust solution. Commented Oct 22, 2022 at 11:53

2 Answers 2

2

Time Machine takes an APFS snapshot and backs up the snapshot. The snapshot is a point-in-time of the disk when the snapshot is taken.

You can validate this by using Disk Utility. First, start a backup and wait for "Preparing" or the actual backup stage. Then open Disk Utility and select your Data partition. Use the View menu and show APFS snapshots. You will see a new one from the time when your backup was started.

-3

You will end up with a consistent backup for some point in time. That point of time cannot be at the start of the backup: If you changed a file again before it is backed up, the original wouldn’t be there anymore.

So when you make changes during a backup, they will be added to the backup. And the completed backup matches your computer at the time the backup was finished.

3
  • This answer makes no sense; I don't think you understand the concept of a Point In Time backup. The statement "and the completed backup matches your computer at the time the backup was finished" makes no sense. Say I start a backup and it backs up file A. Then, before the backup finishes, I change file A. So the backup going to back up file A again?.
    – CryptoFool
    Commented Jan 19, 2023 at 22:38
  • It makes perfect sense. If the changed file isn’t backed up again then your backup doesn’t match the files on your disk. MacOS keeps track of modified files.
    – gnasher729
    Commented Mar 19, 2023 at 16:09
  • @gnasher729 What you say might have been true for HFS+ backups but APFS does take a snapshot
    – mmmmmm
    Commented Nov 14, 2023 at 14:47

You must log in to answer this question.

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