ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Hyper-V and deleting Snapshots

    IT Discussion
    hyperv snapshots virtualization storage
    6
    41
    8.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DustinB3403D
      DustinB3403
      last edited by

      So why doesn't Hyper-V simply remove the original vhdx?

      1 Reply Last reply Reply Quote 0
      • dafyreD
        dafyre
        last edited by

        Because then it would delete everything except the changes that have been made.

        coliverC 1 Reply Last reply Reply Quote 0
        • dafyreD
          dafyre
          last edited by dafyre

          Install Windows Server 2012.... it writes to Server2012.vhdx ... Make a snapshot... it locks Server2012.vhdx and creates a new vhdx file (We'll call it Server2012-Snapshot1.vhdx for simplicity) that only has new changes... So now you install say... SQL Server 2035 Technical Preview and it completely hoses the server...

          Delete the snapshot, and BAM! You are back to a working Server 2012 blank install.

          So you try agan, but this time you install SQL Server 2014... It works. So you make a Snapshot (we'll call it Server2012-Snapshot2.vhdx, keeping in mind that we have completely deleted snapshot1). Then you configure your SQL Server and get it all happy, and then you tell the Snapshot to Merge.

          This looks at the Server2012.vhdx file and compares it with the Server2012-Snapshot2.vhdx (which has information on where these changes would have been written to on the original vhdx).... and then it will take those changes and put them where they should have gone on the original Server2012.vhdx file.

          After it finishes, then it would delete the Snapshot2.vhdx.

          Clear as mud?

          1 Reply Last reply Reply Quote 1
          • coliverC
            coliver @dafyre
            last edited by

            @dafyre said:

            Because then it would delete everything except the changes that have been made.

            This. The new snapshot file only has the changes written to it. It still references back to the original vhdx for reads.

            dafyreD 1 Reply Last reply Reply Quote 1
            • DustinB3403D
              DustinB3403
              last edited by

              So Hyper-V is actually using the original vhdx file, to run the OS and each snapshot to run the changes that were made to the system at the time of the snapshot?

              coliverC scottalanmillerS 2 Replies Last reply Reply Quote 0
              • coliverC
                coliver @DustinB3403
                last edited by

                @DustinB3403 said:

                So Hyper-V is actually using the original vhdx file, to run the OS and each snapshot to run the changes that were made to the system at the time of the snapshot?

                Yep. If you take one snapshot. Then a few weeks later take another it also freezes the previous snapshot and writes all changes to the most recent one. It uses the previous snapshot and the original as references.

                1 Reply Last reply Reply Quote 0
                • dafyreD
                  dafyre @coliver
                  last edited by

                  @coliver Exactly.

                  1 Reply Last reply Reply Quote 0
                  • scottalanmillerS
                    scottalanmiller @DustinB3403
                    last edited by

                    @DustinB3403 said:

                    So Hyper-V is actually using the original vhdx file, to run the OS and each snapshot to run the changes that were made to the system at the time of the snapshot?

                    No, the original file is the "snapshot", the new file is a "delta" file. It writes changes to the delta file and uses both or else your data wouldn't show up.

                    coliverC 1 Reply Last reply Reply Quote 0
                    • coliverC
                      coliver @scottalanmiller
                      last edited by

                      @scottalanmiller said:

                      @DustinB3403 said:

                      So Hyper-V is actually using the original vhdx file, to run the OS and each snapshot to run the changes that were made to the system at the time of the snapshot?

                      No, the original file is the "snapshot", the new file is a "delta" file. It writes changes to the delta file and uses both or else your data wouldn't show up.

                      That was the word I was looking for, "delta".

                      1 Reply Last reply Reply Quote 0
                      • DustinB3403D
                        DustinB3403
                        last edited by

                        Ok so that makes a bit more sense, now the last part.

                        Why if you went to delete a VM and it's snapshots would the system merge them into one large file before dumping the entire item?

                        StrongBadS coliverC dafyreD 3 Replies Last reply Reply Quote 0
                        • StrongBadS
                          StrongBad @DustinB3403
                          last edited by

                          @DustinB3403 said:

                          Ok so that makes a bit more sense, now the last part.

                          Why if you went to delete a VM and it's snapshots would the system merge them into one large file before dumping the entire item?

                          Because otherwise you would lose your data and users would be pretty upset if that happened.

                          1 Reply Last reply Reply Quote 0
                          • coliverC
                            coliver @DustinB3403
                            last edited by coliver

                            @DustinB3403 said:

                            Ok so that makes a bit more sense, now the last part.

                            Why if you went to delete a VM and it's snapshots would the system merge them into one large file before dumping the entire item?

                            That one I don't know.

                            My guess is that the original files and proceeding snapshots are locked for writing. So they have to merge the snapshots one at a time to release them. That is only a guess though.

                            1 Reply Last reply Reply Quote 0
                            • dafyreD
                              dafyre @DustinB3403
                              last edited by

                              @DustinB3403 If you want to delete the entire VM (and its snapshots), it shouldn't try to merge. It would just delete all of the VHD's associated with that particular VM.

                              1 Reply Last reply Reply Quote 0
                              • DustinB3403D
                                DustinB3403
                                last edited by

                                StrongBad I get the part about being upset, but if your goal is to "free space" on your hyper-v server, presumably you know what you're wanting to do, which is the topic of the SW links in the original post.

                                If the only way to free space on your server is to delete the VM's Snapshots, you're effectively deleting the delta changes to the VM.

                                So you're telling the server to "go back to when I first installed the VM" in effect.

                                dafyreD StrongBadS JaredBuschJ 4 Replies Last reply Reply Quote 0
                                • dafyreD
                                  dafyre @DustinB3403
                                  last edited by

                                  @DustinB3403 If you delete the snapshots, then yes.... But if you merge them, then that is when it will free up the space.

                                  Typically what I do is merge in the oldest snapshots to free up space...

                                  1 Reply Last reply Reply Quote 1
                                  • StrongBadS
                                    StrongBad @DustinB3403
                                    last edited by

                                    @DustinB3403 said:

                                    StrongBad I get the part about being upset, but if your goal is to "free space" on your hyper-v server, presumably you know what you're wanting to do, which is the topic of the SW links in the original post.

                                    Deleting snapshots is not an action for freeing space but for merging changes. If someone was doing snapshot deletion for the purpose of savings much space (other than the deltas) then presumably they don't know what they wanted to do.

                                    DustinB3403D 1 Reply Last reply Reply Quote 0
                                    • DustinB3403D
                                      DustinB3403
                                      last edited by

                                      @dafyre which this will initially bloat the file size on the Hyper-V server, correct?

                                      Until the merge is completed, what would happen if you attempted this merge, and didn't have enough free space on your Hyper-V server?

                                      StrongBadS dafyreD 2 Replies Last reply Reply Quote 0
                                      • StrongBadS
                                        StrongBad @DustinB3403
                                        last edited by

                                        @DustinB3403 said:

                                        If the only way to free space on your server is to delete the VM's Snapshots, you're effectively deleting the delta changes to the VM.

                                        So you're telling the server to "go back to when I first installed the VM" in effect.

                                        No, it might seem that way once you learn how each system works under the hood, but all VM platforms work the same - deletions DO remove the snapshot file but they don't kill the data, they merge it. VMware started this because it has a different kind of snapshot file and if HyperV did not keep the terminology you would have people killing their data right and left from confusion.

                                        1 Reply Last reply Reply Quote 0
                                        • DustinB3403D
                                          DustinB3403 @StrongBad
                                          last edited by

                                          @StrongBad I can't speak for the SWOP, I'm just trying to understand Hyper-V as I avoid it here in our environment.

                                          I prefer XenServer as the process is much more straight-forward.

                                          1 Reply Last reply Reply Quote 0
                                          • JaredBuschJ
                                            JaredBusch @DustinB3403
                                            last edited by

                                            @DustinB3403 said:

                                            StrongBad I get the part about being upset, but if your goal is to "free space" on your hyper-v server, presumably you know what you're wanting to do, which is the topic of the SW links in the original post.

                                            If the only way to free space on your server is to delete the VM's Snapshots, you're effectively deleting the delta changes to the VM.

                                            So you're telling the server to "go back to when I first installed the VM" in effect.

                                            You are mixing up terms. you said delete the VM at one point. that to me means the entire VM gone. I have no idea if Hyper-V merges the checkpoints (proper term in hyper-v) or not before deleting. It would seem to be a waste of resources to do so.

                                            If you just meant delete the checkpoints, then yes, of course it has to merge them. They are deltas. This is NO DIFFERENT in Xen or VMWare.

                                            A snapshot is not a backup by itself. You make use of a snapshot to cause the system to cease writing to the .vhdx in order for it to then be copied to a backup medium.

                                            You then merge the snapshot back in unless you need to have some on system return to this point for some reason.

                                            You never keep snapshots for long periods because all you do it create an ever growing delta file.

                                            1 Reply Last reply Reply Quote 1
                                            • 1
                                            • 2
                                            • 3
                                            • 2 / 3
                                            • First post
                                              Last post