Creating mountable snapshot view in macOS












1














I'm used to backup my user's home using rsync. However, I now have data (eg, running database) that shouldn't be backed up while being changed, and I'd like to keep the applications changing them running during the backup.



I know file system snapshot views exist to deal with this problem: Linux has the LVM approach and Apple has Time Machine. However, apparently the former only allows one to mount a snapshot as a virtual file system, so that it's possible to use tools like rsync, tar, or, for what matters, cp, against a view of the files frozen at a given time.



I cannot find any such feature for macOS, tmutil/Time Machine don't look to be the same thing, they must be leveraging the snapshot functionality of their APFS file system, but I can't find any way to see a snapshot as a set of files. Is that possible for APFS?



Note that I'm not interested at all in using Time Machine for my backups: I'm an advanced user and TM is too stupid to suit me fine (it doesn't work over SSH, it doesn't allow me to select a folder on a destination device, it doesn't seem to support multiple backup profiles, each with a different set of sources/destinations and different schedules), nor I'm so interested in spending money on things like SuperDuper!, just to do what that my scripts have done very well for years.










share|improve this question





























    1














    I'm used to backup my user's home using rsync. However, I now have data (eg, running database) that shouldn't be backed up while being changed, and I'd like to keep the applications changing them running during the backup.



    I know file system snapshot views exist to deal with this problem: Linux has the LVM approach and Apple has Time Machine. However, apparently the former only allows one to mount a snapshot as a virtual file system, so that it's possible to use tools like rsync, tar, or, for what matters, cp, against a view of the files frozen at a given time.



    I cannot find any such feature for macOS, tmutil/Time Machine don't look to be the same thing, they must be leveraging the snapshot functionality of their APFS file system, but I can't find any way to see a snapshot as a set of files. Is that possible for APFS?



    Note that I'm not interested at all in using Time Machine for my backups: I'm an advanced user and TM is too stupid to suit me fine (it doesn't work over SSH, it doesn't allow me to select a folder on a destination device, it doesn't seem to support multiple backup profiles, each with a different set of sources/destinations and different schedules), nor I'm so interested in spending money on things like SuperDuper!, just to do what that my scripts have done very well for years.










    share|improve this question



























      1












      1








      1







      I'm used to backup my user's home using rsync. However, I now have data (eg, running database) that shouldn't be backed up while being changed, and I'd like to keep the applications changing them running during the backup.



      I know file system snapshot views exist to deal with this problem: Linux has the LVM approach and Apple has Time Machine. However, apparently the former only allows one to mount a snapshot as a virtual file system, so that it's possible to use tools like rsync, tar, or, for what matters, cp, against a view of the files frozen at a given time.



      I cannot find any such feature for macOS, tmutil/Time Machine don't look to be the same thing, they must be leveraging the snapshot functionality of their APFS file system, but I can't find any way to see a snapshot as a set of files. Is that possible for APFS?



      Note that I'm not interested at all in using Time Machine for my backups: I'm an advanced user and TM is too stupid to suit me fine (it doesn't work over SSH, it doesn't allow me to select a folder on a destination device, it doesn't seem to support multiple backup profiles, each with a different set of sources/destinations and different schedules), nor I'm so interested in spending money on things like SuperDuper!, just to do what that my scripts have done very well for years.










      share|improve this question















      I'm used to backup my user's home using rsync. However, I now have data (eg, running database) that shouldn't be backed up while being changed, and I'd like to keep the applications changing them running during the backup.



      I know file system snapshot views exist to deal with this problem: Linux has the LVM approach and Apple has Time Machine. However, apparently the former only allows one to mount a snapshot as a virtual file system, so that it's possible to use tools like rsync, tar, or, for what matters, cp, against a view of the files frozen at a given time.



      I cannot find any such feature for macOS, tmutil/Time Machine don't look to be the same thing, they must be leveraging the snapshot functionality of their APFS file system, but I can't find any way to see a snapshot as a set of files. Is that possible for APFS?



      Note that I'm not interested at all in using Time Machine for my backups: I'm an advanced user and TM is too stupid to suit me fine (it doesn't work over SSH, it doesn't allow me to select a folder on a destination device, it doesn't seem to support multiple backup profiles, each with a different set of sources/destinations and different schedules), nor I'm so interested in spending money on things like SuperDuper!, just to do what that my scripts have done very well for years.







      macos backup time-machine filesystem apfs






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 20 mins ago









      bmike

      156k46282607




      156k46282607










      asked 2 hours ago









      zakmck

      1235




      1235






















          1 Answer
          1






          active

          oldest

          votes


















          2














          Yes, it is definitely possible to view an APFS snapshot as a "set of files" - i.e. a file system. This is done simply by mounting the snapshot - exactly like you would do with LVM on Linux.



          The syntax is:



            mount_apfs -s <snapshot name> <mounted base volume> <mount folder>


          So for example create a snapshot with:



            tmutil snapshot /


          It will say that the new snapshot is named for example: 2019-01-01-180510.



          Then later you can create a folder "MyBackup" and mount the snapshot like this:



            mount_apfs -s com.apple.TimeMachine.2019-01-01-180510 / MyBackup


          If you then browse MyBackup you'll see the files like they were at the time the snapshot was taken.



          Note: You don't have to use snapshots created by TimeMachine. Any APFS snapshots will be mountable with the same command.






          share|improve this answer





















          • Thanks a lot @jksoegaard, just tried it and works perfectly! I see there are tmutil alternatives (eg, arstechnica.com/gadgets/2017/02/…), but that's a minor issue for me.
            – zakmck
            39 mins ago






          • 1




            Note that the alternative (fs_snapshot) isn't available to ordinary users. Only certain developers can actually take advantage of it.
            – jksoegaard
            37 mins ago













          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "118"
          };
          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',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          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%2fapple.stackexchange.com%2fquestions%2f347242%2fcreating-mountable-snapshot-view-in-macos%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









          2














          Yes, it is definitely possible to view an APFS snapshot as a "set of files" - i.e. a file system. This is done simply by mounting the snapshot - exactly like you would do with LVM on Linux.



          The syntax is:



            mount_apfs -s <snapshot name> <mounted base volume> <mount folder>


          So for example create a snapshot with:



            tmutil snapshot /


          It will say that the new snapshot is named for example: 2019-01-01-180510.



          Then later you can create a folder "MyBackup" and mount the snapshot like this:



            mount_apfs -s com.apple.TimeMachine.2019-01-01-180510 / MyBackup


          If you then browse MyBackup you'll see the files like they were at the time the snapshot was taken.



          Note: You don't have to use snapshots created by TimeMachine. Any APFS snapshots will be mountable with the same command.






          share|improve this answer





















          • Thanks a lot @jksoegaard, just tried it and works perfectly! I see there are tmutil alternatives (eg, arstechnica.com/gadgets/2017/02/…), but that's a minor issue for me.
            – zakmck
            39 mins ago






          • 1




            Note that the alternative (fs_snapshot) isn't available to ordinary users. Only certain developers can actually take advantage of it.
            – jksoegaard
            37 mins ago


















          2














          Yes, it is definitely possible to view an APFS snapshot as a "set of files" - i.e. a file system. This is done simply by mounting the snapshot - exactly like you would do with LVM on Linux.



          The syntax is:



            mount_apfs -s <snapshot name> <mounted base volume> <mount folder>


          So for example create a snapshot with:



            tmutil snapshot /


          It will say that the new snapshot is named for example: 2019-01-01-180510.



          Then later you can create a folder "MyBackup" and mount the snapshot like this:



            mount_apfs -s com.apple.TimeMachine.2019-01-01-180510 / MyBackup


          If you then browse MyBackup you'll see the files like they were at the time the snapshot was taken.



          Note: You don't have to use snapshots created by TimeMachine. Any APFS snapshots will be mountable with the same command.






          share|improve this answer





















          • Thanks a lot @jksoegaard, just tried it and works perfectly! I see there are tmutil alternatives (eg, arstechnica.com/gadgets/2017/02/…), but that's a minor issue for me.
            – zakmck
            39 mins ago






          • 1




            Note that the alternative (fs_snapshot) isn't available to ordinary users. Only certain developers can actually take advantage of it.
            – jksoegaard
            37 mins ago
















          2












          2








          2






          Yes, it is definitely possible to view an APFS snapshot as a "set of files" - i.e. a file system. This is done simply by mounting the snapshot - exactly like you would do with LVM on Linux.



          The syntax is:



            mount_apfs -s <snapshot name> <mounted base volume> <mount folder>


          So for example create a snapshot with:



            tmutil snapshot /


          It will say that the new snapshot is named for example: 2019-01-01-180510.



          Then later you can create a folder "MyBackup" and mount the snapshot like this:



            mount_apfs -s com.apple.TimeMachine.2019-01-01-180510 / MyBackup


          If you then browse MyBackup you'll see the files like they were at the time the snapshot was taken.



          Note: You don't have to use snapshots created by TimeMachine. Any APFS snapshots will be mountable with the same command.






          share|improve this answer












          Yes, it is definitely possible to view an APFS snapshot as a "set of files" - i.e. a file system. This is done simply by mounting the snapshot - exactly like you would do with LVM on Linux.



          The syntax is:



            mount_apfs -s <snapshot name> <mounted base volume> <mount folder>


          So for example create a snapshot with:



            tmutil snapshot /


          It will say that the new snapshot is named for example: 2019-01-01-180510.



          Then later you can create a folder "MyBackup" and mount the snapshot like this:



            mount_apfs -s com.apple.TimeMachine.2019-01-01-180510 / MyBackup


          If you then browse MyBackup you'll see the files like they were at the time the snapshot was taken.



          Note: You don't have to use snapshots created by TimeMachine. Any APFS snapshots will be mountable with the same command.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 50 mins ago









          jksoegaard

          15.5k1642




          15.5k1642












          • Thanks a lot @jksoegaard, just tried it and works perfectly! I see there are tmutil alternatives (eg, arstechnica.com/gadgets/2017/02/…), but that's a minor issue for me.
            – zakmck
            39 mins ago






          • 1




            Note that the alternative (fs_snapshot) isn't available to ordinary users. Only certain developers can actually take advantage of it.
            – jksoegaard
            37 mins ago




















          • Thanks a lot @jksoegaard, just tried it and works perfectly! I see there are tmutil alternatives (eg, arstechnica.com/gadgets/2017/02/…), but that's a minor issue for me.
            – zakmck
            39 mins ago






          • 1




            Note that the alternative (fs_snapshot) isn't available to ordinary users. Only certain developers can actually take advantage of it.
            – jksoegaard
            37 mins ago


















          Thanks a lot @jksoegaard, just tried it and works perfectly! I see there are tmutil alternatives (eg, arstechnica.com/gadgets/2017/02/…), but that's a minor issue for me.
          – zakmck
          39 mins ago




          Thanks a lot @jksoegaard, just tried it and works perfectly! I see there are tmutil alternatives (eg, arstechnica.com/gadgets/2017/02/…), but that's a minor issue for me.
          – zakmck
          39 mins ago




          1




          1




          Note that the alternative (fs_snapshot) isn't available to ordinary users. Only certain developers can actually take advantage of it.
          – jksoegaard
          37 mins ago






          Note that the alternative (fs_snapshot) isn't available to ordinary users. Only certain developers can actually take advantage of it.
          – jksoegaard
          37 mins ago




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Different!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fapple.stackexchange.com%2fquestions%2f347242%2fcreating-mountable-snapshot-view-in-macos%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

          Understanding the information contained in the Deep Space Network XML data?

          Ross-on-Wye

          Eastern Orthodox Church