How does deleting old backups from time machine work











up vote
2
down vote

favorite












Time machine uses incremental backups, so to restore a backup it needs all backups made. Time machine also has the feature to delete the oldest backup when there is no free space anymore.

But isn't this destroying the backup? There is a backup missing in the history. How does time machine handle this? What am I missing?










share|improve this question


























    up vote
    2
    down vote

    favorite












    Time machine uses incremental backups, so to restore a backup it needs all backups made. Time machine also has the feature to delete the oldest backup when there is no free space anymore.

    But isn't this destroying the backup? There is a backup missing in the history. How does time machine handle this? What am I missing?










    share|improve this question
























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      Time machine uses incremental backups, so to restore a backup it needs all backups made. Time machine also has the feature to delete the oldest backup when there is no free space anymore.

      But isn't this destroying the backup? There is a backup missing in the history. How does time machine handle this? What am I missing?










      share|improve this question













      Time machine uses incremental backups, so to restore a backup it needs all backups made. Time machine also has the feature to delete the oldest backup when there is no free space anymore.

      But isn't this destroying the backup? There is a backup missing in the history. How does time machine handle this? What am I missing?







      time-machine incremental-backup






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 16 at 7:15









      Lithilion

      1237




      1237






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          Short answer: it works fine thanks to weird filesystem magic.



          Long answer: well, first, let's go over how a normal incremental backup system works (I think you already know this, but just to set the scene...) Suppose you do an initial backup and two incrementals based on it:




          • In the initial backup, it copies all files from the source

          • In the first incremental, it copies only files that changed since the initial backup

          • In the second incremental, it copies only files that changed since the first incremental


          In order to recover a bunch of files from the "latest backup", you'll need to splice together files from all three, depending on when each file was last modified.



          If you delete the first backup, then all of the files that didn't change since that backup (& hence get backed up in one of the incrementals) are gone. This is the situation you assume in the question.



          Time machine works a bit differently. Here's how the same sequence would work with Time Machine:




          • In the initial backup, it copies all files from the source (into a timestamped snapshot directory on the backup target).


          • In the first incremental, it copies only files that changed since the initial backup (into a new snapshot directory) and adds hard links to files and directories that didn't change (except those that were deleted between the backups).



            Hard links are additional directory entries that point to the same file that the original entry did. Standard unix filesystems allow files to be hard-linked, but not directories; Apple figured out how to allow it for directories as well under the MacOS Extended filesystem. Anyway, the net result is that the second snapshot directory actually contains all files that existed when the second backup was made.



          • In the second incremental, it again copies only files that changed since the first incremental, adds hard links to files and directories that didn't change (except those that were deleted). Again, this snapshot directory actually contains all files that existed when the third backup was made.



          In order to recover a bunch of files from the "latest backup", no splicing is needed, since all of the files are already there in the latest snapshot directory. In fact, you can just open up the snapshot folder in the Finder, and see all the files that're part of that snapshot. But please don't make changes, or you may mess up not just that snapshot, but all the other ones it's interlinked with.



          If you delete the first backup, then all of the files and directories in it get unlinked from that snapshot directory. But not necessarily deleted, that only happens when the last link is removed. Thus, all of the files (/versions of files) that were only in that snapshot get deleted, but those that were still around when the later backups were made still remain in existence, and are still in the other snapshot(s) they're valid for.



          In fact, you (or the Time Machine backup system) can delete snapshots in any order without creating gaps in the later backups. TM uses this as part of its standard backup schedule: It creates a new snapshot once an hour, but after 24 hours it starts deleting most of those, leaving just one per day. After a month, it starts deleting most of the dailies, leaving just one per week. Because of the hard-linking, this doesn't cause any missing files in the snapshots that're retained.



          (But again: don't make changes in the backup directories, or you may break things. TM has options to delete particular snapshots, or delete specific files from all snapshots they occur in, and these are safe. Other changes... not so safe.)






          share|improve this answer





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1375902%2fhow-does-deleting-old-backups-from-time-machine-work%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            3
            down vote



            accepted










            Short answer: it works fine thanks to weird filesystem magic.



            Long answer: well, first, let's go over how a normal incremental backup system works (I think you already know this, but just to set the scene...) Suppose you do an initial backup and two incrementals based on it:




            • In the initial backup, it copies all files from the source

            • In the first incremental, it copies only files that changed since the initial backup

            • In the second incremental, it copies only files that changed since the first incremental


            In order to recover a bunch of files from the "latest backup", you'll need to splice together files from all three, depending on when each file was last modified.



            If you delete the first backup, then all of the files that didn't change since that backup (& hence get backed up in one of the incrementals) are gone. This is the situation you assume in the question.



            Time machine works a bit differently. Here's how the same sequence would work with Time Machine:




            • In the initial backup, it copies all files from the source (into a timestamped snapshot directory on the backup target).


            • In the first incremental, it copies only files that changed since the initial backup (into a new snapshot directory) and adds hard links to files and directories that didn't change (except those that were deleted between the backups).



              Hard links are additional directory entries that point to the same file that the original entry did. Standard unix filesystems allow files to be hard-linked, but not directories; Apple figured out how to allow it for directories as well under the MacOS Extended filesystem. Anyway, the net result is that the second snapshot directory actually contains all files that existed when the second backup was made.



            • In the second incremental, it again copies only files that changed since the first incremental, adds hard links to files and directories that didn't change (except those that were deleted). Again, this snapshot directory actually contains all files that existed when the third backup was made.



            In order to recover a bunch of files from the "latest backup", no splicing is needed, since all of the files are already there in the latest snapshot directory. In fact, you can just open up the snapshot folder in the Finder, and see all the files that're part of that snapshot. But please don't make changes, or you may mess up not just that snapshot, but all the other ones it's interlinked with.



            If you delete the first backup, then all of the files and directories in it get unlinked from that snapshot directory. But not necessarily deleted, that only happens when the last link is removed. Thus, all of the files (/versions of files) that were only in that snapshot get deleted, but those that were still around when the later backups were made still remain in existence, and are still in the other snapshot(s) they're valid for.



            In fact, you (or the Time Machine backup system) can delete snapshots in any order without creating gaps in the later backups. TM uses this as part of its standard backup schedule: It creates a new snapshot once an hour, but after 24 hours it starts deleting most of those, leaving just one per day. After a month, it starts deleting most of the dailies, leaving just one per week. Because of the hard-linking, this doesn't cause any missing files in the snapshots that're retained.



            (But again: don't make changes in the backup directories, or you may break things. TM has options to delete particular snapshots, or delete specific files from all snapshots they occur in, and these are safe. Other changes... not so safe.)






            share|improve this answer

























              up vote
              3
              down vote



              accepted










              Short answer: it works fine thanks to weird filesystem magic.



              Long answer: well, first, let's go over how a normal incremental backup system works (I think you already know this, but just to set the scene...) Suppose you do an initial backup and two incrementals based on it:




              • In the initial backup, it copies all files from the source

              • In the first incremental, it copies only files that changed since the initial backup

              • In the second incremental, it copies only files that changed since the first incremental


              In order to recover a bunch of files from the "latest backup", you'll need to splice together files from all three, depending on when each file was last modified.



              If you delete the first backup, then all of the files that didn't change since that backup (& hence get backed up in one of the incrementals) are gone. This is the situation you assume in the question.



              Time machine works a bit differently. Here's how the same sequence would work with Time Machine:




              • In the initial backup, it copies all files from the source (into a timestamped snapshot directory on the backup target).


              • In the first incremental, it copies only files that changed since the initial backup (into a new snapshot directory) and adds hard links to files and directories that didn't change (except those that were deleted between the backups).



                Hard links are additional directory entries that point to the same file that the original entry did. Standard unix filesystems allow files to be hard-linked, but not directories; Apple figured out how to allow it for directories as well under the MacOS Extended filesystem. Anyway, the net result is that the second snapshot directory actually contains all files that existed when the second backup was made.



              • In the second incremental, it again copies only files that changed since the first incremental, adds hard links to files and directories that didn't change (except those that were deleted). Again, this snapshot directory actually contains all files that existed when the third backup was made.



              In order to recover a bunch of files from the "latest backup", no splicing is needed, since all of the files are already there in the latest snapshot directory. In fact, you can just open up the snapshot folder in the Finder, and see all the files that're part of that snapshot. But please don't make changes, or you may mess up not just that snapshot, but all the other ones it's interlinked with.



              If you delete the first backup, then all of the files and directories in it get unlinked from that snapshot directory. But not necessarily deleted, that only happens when the last link is removed. Thus, all of the files (/versions of files) that were only in that snapshot get deleted, but those that were still around when the later backups were made still remain in existence, and are still in the other snapshot(s) they're valid for.



              In fact, you (or the Time Machine backup system) can delete snapshots in any order without creating gaps in the later backups. TM uses this as part of its standard backup schedule: It creates a new snapshot once an hour, but after 24 hours it starts deleting most of those, leaving just one per day. After a month, it starts deleting most of the dailies, leaving just one per week. Because of the hard-linking, this doesn't cause any missing files in the snapshots that're retained.



              (But again: don't make changes in the backup directories, or you may break things. TM has options to delete particular snapshots, or delete specific files from all snapshots they occur in, and these are safe. Other changes... not so safe.)






              share|improve this answer























                up vote
                3
                down vote



                accepted







                up vote
                3
                down vote



                accepted






                Short answer: it works fine thanks to weird filesystem magic.



                Long answer: well, first, let's go over how a normal incremental backup system works (I think you already know this, but just to set the scene...) Suppose you do an initial backup and two incrementals based on it:




                • In the initial backup, it copies all files from the source

                • In the first incremental, it copies only files that changed since the initial backup

                • In the second incremental, it copies only files that changed since the first incremental


                In order to recover a bunch of files from the "latest backup", you'll need to splice together files from all three, depending on when each file was last modified.



                If you delete the first backup, then all of the files that didn't change since that backup (& hence get backed up in one of the incrementals) are gone. This is the situation you assume in the question.



                Time machine works a bit differently. Here's how the same sequence would work with Time Machine:




                • In the initial backup, it copies all files from the source (into a timestamped snapshot directory on the backup target).


                • In the first incremental, it copies only files that changed since the initial backup (into a new snapshot directory) and adds hard links to files and directories that didn't change (except those that were deleted between the backups).



                  Hard links are additional directory entries that point to the same file that the original entry did. Standard unix filesystems allow files to be hard-linked, but not directories; Apple figured out how to allow it for directories as well under the MacOS Extended filesystem. Anyway, the net result is that the second snapshot directory actually contains all files that existed when the second backup was made.



                • In the second incremental, it again copies only files that changed since the first incremental, adds hard links to files and directories that didn't change (except those that were deleted). Again, this snapshot directory actually contains all files that existed when the third backup was made.



                In order to recover a bunch of files from the "latest backup", no splicing is needed, since all of the files are already there in the latest snapshot directory. In fact, you can just open up the snapshot folder in the Finder, and see all the files that're part of that snapshot. But please don't make changes, or you may mess up not just that snapshot, but all the other ones it's interlinked with.



                If you delete the first backup, then all of the files and directories in it get unlinked from that snapshot directory. But not necessarily deleted, that only happens when the last link is removed. Thus, all of the files (/versions of files) that were only in that snapshot get deleted, but those that were still around when the later backups were made still remain in existence, and are still in the other snapshot(s) they're valid for.



                In fact, you (or the Time Machine backup system) can delete snapshots in any order without creating gaps in the later backups. TM uses this as part of its standard backup schedule: It creates a new snapshot once an hour, but after 24 hours it starts deleting most of those, leaving just one per day. After a month, it starts deleting most of the dailies, leaving just one per week. Because of the hard-linking, this doesn't cause any missing files in the snapshots that're retained.



                (But again: don't make changes in the backup directories, or you may break things. TM has options to delete particular snapshots, or delete specific files from all snapshots they occur in, and these are safe. Other changes... not so safe.)






                share|improve this answer












                Short answer: it works fine thanks to weird filesystem magic.



                Long answer: well, first, let's go over how a normal incremental backup system works (I think you already know this, but just to set the scene...) Suppose you do an initial backup and two incrementals based on it:




                • In the initial backup, it copies all files from the source

                • In the first incremental, it copies only files that changed since the initial backup

                • In the second incremental, it copies only files that changed since the first incremental


                In order to recover a bunch of files from the "latest backup", you'll need to splice together files from all three, depending on when each file was last modified.



                If you delete the first backup, then all of the files that didn't change since that backup (& hence get backed up in one of the incrementals) are gone. This is the situation you assume in the question.



                Time machine works a bit differently. Here's how the same sequence would work with Time Machine:




                • In the initial backup, it copies all files from the source (into a timestamped snapshot directory on the backup target).


                • In the first incremental, it copies only files that changed since the initial backup (into a new snapshot directory) and adds hard links to files and directories that didn't change (except those that were deleted between the backups).



                  Hard links are additional directory entries that point to the same file that the original entry did. Standard unix filesystems allow files to be hard-linked, but not directories; Apple figured out how to allow it for directories as well under the MacOS Extended filesystem. Anyway, the net result is that the second snapshot directory actually contains all files that existed when the second backup was made.



                • In the second incremental, it again copies only files that changed since the first incremental, adds hard links to files and directories that didn't change (except those that were deleted). Again, this snapshot directory actually contains all files that existed when the third backup was made.



                In order to recover a bunch of files from the "latest backup", no splicing is needed, since all of the files are already there in the latest snapshot directory. In fact, you can just open up the snapshot folder in the Finder, and see all the files that're part of that snapshot. But please don't make changes, or you may mess up not just that snapshot, but all the other ones it's interlinked with.



                If you delete the first backup, then all of the files and directories in it get unlinked from that snapshot directory. But not necessarily deleted, that only happens when the last link is removed. Thus, all of the files (/versions of files) that were only in that snapshot get deleted, but those that were still around when the later backups were made still remain in existence, and are still in the other snapshot(s) they're valid for.



                In fact, you (or the Time Machine backup system) can delete snapshots in any order without creating gaps in the later backups. TM uses this as part of its standard backup schedule: It creates a new snapshot once an hour, but after 24 hours it starts deleting most of those, leaving just one per day. After a month, it starts deleting most of the dailies, leaving just one per week. Because of the hard-linking, this doesn't cause any missing files in the snapshots that're retained.



                (But again: don't make changes in the backup directories, or you may break things. TM has options to delete particular snapshots, or delete specific files from all snapshots they occur in, and these are safe. Other changes... not so safe.)







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 17 at 7:29









                Gordon Davisson

                25.3k44350




                25.3k44350






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1375902%2fhow-does-deleting-old-backups-from-time-machine-work%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Plaza Victoria

                    Puebla de Zaragoza

                    Musa