ZFS test rollback doesn't work as expected

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












I am confused about how ZFS snapshots and rollback are supposed to work.
I have a zpool containing a couple zvols (each made from partitions of a mirrorvdev). I make a snapshot like this:



~$ sudo zfs snapshot nvme-tank@roll_test


Then I boot a VM located on one of the zvols in the zpool and create a test file



~$ echo "This is a test of the rollback system" > rbtest.txt


Then I shut down the VM and do the rollback. As I understand the concept, the rollback should revert everything in nvme-tank to the state it was when I took the snapshot, before making rbtest.txt.



~$ sudo zfs rollback nvme-tank@roll_test


I then reboot the vm, check for rbtest.txt, and there it is, still there!
enter image description here



The snapshot is there:



~$ zfs list -t all -r nvme-tank
NAME USED AVAIL REFER MOUNTPOINT
nvme-tank 887G 12.1G 24K /media/nvme-tank
nvme-tank@nov82018 0B - 24K -
nvme-tank@roll_test 0B - 24K -
nvme-tank/ext4-zvol 474G 449G 37.8G -
nvme-tank/ntfs-zvol 413G 23.9G 401G -


So, am I misunderstanding what snapshots are supposed to do, using them incorrectly, or is something broken with my zfs?










share|improve this question

























    up vote
    3
    down vote

    favorite












    I am confused about how ZFS snapshots and rollback are supposed to work.
    I have a zpool containing a couple zvols (each made from partitions of a mirrorvdev). I make a snapshot like this:



    ~$ sudo zfs snapshot nvme-tank@roll_test


    Then I boot a VM located on one of the zvols in the zpool and create a test file



    ~$ echo "This is a test of the rollback system" > rbtest.txt


    Then I shut down the VM and do the rollback. As I understand the concept, the rollback should revert everything in nvme-tank to the state it was when I took the snapshot, before making rbtest.txt.



    ~$ sudo zfs rollback nvme-tank@roll_test


    I then reboot the vm, check for rbtest.txt, and there it is, still there!
    enter image description here



    The snapshot is there:



    ~$ zfs list -t all -r nvme-tank
    NAME USED AVAIL REFER MOUNTPOINT
    nvme-tank 887G 12.1G 24K /media/nvme-tank
    nvme-tank@nov82018 0B - 24K -
    nvme-tank@roll_test 0B - 24K -
    nvme-tank/ext4-zvol 474G 449G 37.8G -
    nvme-tank/ntfs-zvol 413G 23.9G 401G -


    So, am I misunderstanding what snapshots are supposed to do, using them incorrectly, or is something broken with my zfs?










    share|improve this question























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      I am confused about how ZFS snapshots and rollback are supposed to work.
      I have a zpool containing a couple zvols (each made from partitions of a mirrorvdev). I make a snapshot like this:



      ~$ sudo zfs snapshot nvme-tank@roll_test


      Then I boot a VM located on one of the zvols in the zpool and create a test file



      ~$ echo "This is a test of the rollback system" > rbtest.txt


      Then I shut down the VM and do the rollback. As I understand the concept, the rollback should revert everything in nvme-tank to the state it was when I took the snapshot, before making rbtest.txt.



      ~$ sudo zfs rollback nvme-tank@roll_test


      I then reboot the vm, check for rbtest.txt, and there it is, still there!
      enter image description here



      The snapshot is there:



      ~$ zfs list -t all -r nvme-tank
      NAME USED AVAIL REFER MOUNTPOINT
      nvme-tank 887G 12.1G 24K /media/nvme-tank
      nvme-tank@nov82018 0B - 24K -
      nvme-tank@roll_test 0B - 24K -
      nvme-tank/ext4-zvol 474G 449G 37.8G -
      nvme-tank/ntfs-zvol 413G 23.9G 401G -


      So, am I misunderstanding what snapshots are supposed to do, using them incorrectly, or is something broken with my zfs?










      share|improve this question













      I am confused about how ZFS snapshots and rollback are supposed to work.
      I have a zpool containing a couple zvols (each made from partitions of a mirrorvdev). I make a snapshot like this:



      ~$ sudo zfs snapshot nvme-tank@roll_test


      Then I boot a VM located on one of the zvols in the zpool and create a test file



      ~$ echo "This is a test of the rollback system" > rbtest.txt


      Then I shut down the VM and do the rollback. As I understand the concept, the rollback should revert everything in nvme-tank to the state it was when I took the snapshot, before making rbtest.txt.



      ~$ sudo zfs rollback nvme-tank@roll_test


      I then reboot the vm, check for rbtest.txt, and there it is, still there!
      enter image description here



      The snapshot is there:



      ~$ zfs list -t all -r nvme-tank
      NAME USED AVAIL REFER MOUNTPOINT
      nvme-tank 887G 12.1G 24K /media/nvme-tank
      nvme-tank@nov82018 0B - 24K -
      nvme-tank@roll_test 0B - 24K -
      nvme-tank/ext4-zvol 474G 449G 37.8G -
      nvme-tank/ntfs-zvol 413G 23.9G 401G -


      So, am I misunderstanding what snapshots are supposed to do, using them incorrectly, or is something broken with my zfs?







      zfs snapshot zfsonlinux rollback






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 4 hours ago









      Thoughtcraft

      1426




      1426




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          You only snapshotted nvme-tank, but you didn't snapshot either of nvme-tank/ext4-zvol or nvme-tank/ntfs-zvol, one of which contains the file you created. So nothing happened because you were snapshotting a different dataset than the one you created the file in.



          If you want snapshots to be recursive to descendent datasets/zvols, you have to explicitly ask for recursive snapshots, with zfs snapshot -r. However, you can only rollback one specific dataset/zvol at a time with zfs rollback.






          share|improve this answer




















          • Additionally, in OpenZFS a new feature channel programs (illumos version of the man page) will allow you to recursively rollback a bunch of datasets at once, but you'll have to write a short Lua script to implement that specific function.
            – Dan
            2 hours ago











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "2"
          ;
          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%2fserverfault.com%2fquestions%2f939237%2fzfs-test-rollback-doesnt-work-as-expected%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          3
          down vote



          accepted










          You only snapshotted nvme-tank, but you didn't snapshot either of nvme-tank/ext4-zvol or nvme-tank/ntfs-zvol, one of which contains the file you created. So nothing happened because you were snapshotting a different dataset than the one you created the file in.



          If you want snapshots to be recursive to descendent datasets/zvols, you have to explicitly ask for recursive snapshots, with zfs snapshot -r. However, you can only rollback one specific dataset/zvol at a time with zfs rollback.






          share|improve this answer




















          • Additionally, in OpenZFS a new feature channel programs (illumos version of the man page) will allow you to recursively rollback a bunch of datasets at once, but you'll have to write a short Lua script to implement that specific function.
            – Dan
            2 hours ago















          up vote
          3
          down vote



          accepted










          You only snapshotted nvme-tank, but you didn't snapshot either of nvme-tank/ext4-zvol or nvme-tank/ntfs-zvol, one of which contains the file you created. So nothing happened because you were snapshotting a different dataset than the one you created the file in.



          If you want snapshots to be recursive to descendent datasets/zvols, you have to explicitly ask for recursive snapshots, with zfs snapshot -r. However, you can only rollback one specific dataset/zvol at a time with zfs rollback.






          share|improve this answer




















          • Additionally, in OpenZFS a new feature channel programs (illumos version of the man page) will allow you to recursively rollback a bunch of datasets at once, but you'll have to write a short Lua script to implement that specific function.
            – Dan
            2 hours ago













          up vote
          3
          down vote



          accepted







          up vote
          3
          down vote



          accepted






          You only snapshotted nvme-tank, but you didn't snapshot either of nvme-tank/ext4-zvol or nvme-tank/ntfs-zvol, one of which contains the file you created. So nothing happened because you were snapshotting a different dataset than the one you created the file in.



          If you want snapshots to be recursive to descendent datasets/zvols, you have to explicitly ask for recursive snapshots, with zfs snapshot -r. However, you can only rollback one specific dataset/zvol at a time with zfs rollback.






          share|improve this answer












          You only snapshotted nvme-tank, but you didn't snapshot either of nvme-tank/ext4-zvol or nvme-tank/ntfs-zvol, one of which contains the file you created. So nothing happened because you were snapshotting a different dataset than the one you created the file in.



          If you want snapshots to be recursive to descendent datasets/zvols, you have to explicitly ask for recursive snapshots, with zfs snapshot -r. However, you can only rollback one specific dataset/zvol at a time with zfs rollback.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 3 hours ago









          Michael Hampton♦

          160k26296604




          160k26296604











          • Additionally, in OpenZFS a new feature channel programs (illumos version of the man page) will allow you to recursively rollback a bunch of datasets at once, but you'll have to write a short Lua script to implement that specific function.
            – Dan
            2 hours ago

















          • Additionally, in OpenZFS a new feature channel programs (illumos version of the man page) will allow you to recursively rollback a bunch of datasets at once, but you'll have to write a short Lua script to implement that specific function.
            – Dan
            2 hours ago
















          Additionally, in OpenZFS a new feature channel programs (illumos version of the man page) will allow you to recursively rollback a bunch of datasets at once, but you'll have to write a short Lua script to implement that specific function.
          – Dan
          2 hours ago





          Additionally, in OpenZFS a new feature channel programs (illumos version of the man page) will allow you to recursively rollback a bunch of datasets at once, but you'll have to write a short Lua script to implement that specific function.
          – Dan
          2 hours ago


















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f939237%2fzfs-test-rollback-doesnt-work-as-expected%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?