{"id":2095,"date":"2021-12-22T03:45:37","date_gmt":"2021-12-22T01:45:37","guid":{"rendered":"https:\/\/itsimple.info\/?p=2095"},"modified":"2021-12-22T03:50:37","modified_gmt":"2021-12-22T01:50:37","slug":"how-to-merge-hyper-v-disk-and-remove-snapshot","status":"publish","type":"post","link":"https:\/\/itsimple.info\/?p=2095","title":{"rendered":"How To Merge Hyper-V disk and Remove Snapshot"},"content":{"rendered":"\n<p>Hyper-v can create checkpoint \/ Snapshot in many ways, sometime removing them can be a pain in the A&#8230; Especially  if they have been created by 3rd party software. The simple way to remove snapshot is through the Hyper-v manager, just click on the VM and in the checkpoint window delete the checkpoint :<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"419\" height=\"212\" src=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/deleteSanpshot.png\" alt=\"\" data-id=\"2096\" data-full-url=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/deleteSanpshot.png\" data-link=\"https:\/\/itsimple.info\/?attachment_id=2096\" class=\"wp-image-2096\" srcset=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/deleteSanpshot.png 419w, https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/deleteSanpshot-300x152.png 300w\" sizes=\"auto, (max-width: 419px) 100vw, 419px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p>Some time the Checkpoints window is empty yet you have recovery points. and the VM disks spread on snaps. Powershell can help here :<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Get-VMSnapshot -VMname \"your vm name\"\nGet-VMSnapshot -VMname \"your vm name\" | Remove-VMsnapshot\n <\/pre>\n\n\n\n<figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"644\" height=\"142\" src=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Remove-Snapshot_Prograss.png\" alt=\"\" data-id=\"2097\" data-full-url=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Remove-Snapshot_Prograss.png\" data-link=\"https:\/\/itsimple.info\/?attachment_id=2097\" class=\"wp-image-2097\" srcset=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Remove-Snapshot_Prograss.png 644w, https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Remove-Snapshot_Prograss-300x66.png 300w\" sizes=\"auto, (max-width: 644px) 100vw, 644px\" \/><\/figure><\/li><\/ul><figcaption class=\"blocks-gallery-caption\">you can check the merge status on the hyper-v manager<\/figcaption><\/figure>\n\n\n\n<p>When using backup software like Veeam or Acronis they backup the VM&#8217;s through the host, some time the create checkpoint but do not merge them back leaving differential disk in the format of : avhdx <\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-2 is-cropped wp-block-gallery-3 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"590\" height=\"272\" src=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/differentialDisk1.png\" alt=\"\" data-id=\"2098\" data-link=\"https:\/\/itsimple.info\/?attachment_id=2098\" class=\"wp-image-2098\" srcset=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/differentialDisk1.png 590w, https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/differentialDisk1-300x138.png 300w\" sizes=\"auto, (max-width: 590px) 100vw, 590px\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"590\" height=\"205\" src=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/differentialDisk2.png\" alt=\"\" data-id=\"2099\" data-full-url=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/differentialDisk2.png\" data-link=\"https:\/\/itsimple.info\/?attachment_id=2099\" class=\"wp-image-2099\" srcset=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/differentialDisk2.png 590w, https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/differentialDisk2-300x104.png 300w\" sizes=\"auto, (max-width: 590px) 100vw, 590px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p>In this case you need to merge the disk manually with the help of the feature &#8220;Edit Disk&#8221; in the hyper-v manager<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-4 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"932\" height=\"326\" src=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots.png\" alt=\"\" data-id=\"2100\" data-full-url=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots.png\" data-link=\"https:\/\/itsimple.info\/?attachment_id=2100\" class=\"wp-image-2100\" srcset=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots.png 932w, https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots-300x105.png 300w, https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots-768x269.png 768w\" sizes=\"auto, (max-width: 932px) 100vw, 932px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p>Choose &#8220;Edit Disk&#8221; -&gt; locate your latest avhdx disk and merge it to his parent -&gt; in case of few you need to repeat this step until reaching the base VM disk with the vhdx file type :<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-5 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"867\" height=\"655\" src=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots-2.png\" alt=\"\" data-id=\"2102\" data-full-url=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots-2.png\" data-link=\"https:\/\/itsimple.info\/?attachment_id=2102\" class=\"wp-image-2102\" srcset=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots-2.png 867w, https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots-2-300x227.png 300w, https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots-2-768x580.png 768w, https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots-2-131x98.png 131w\" sizes=\"auto, (max-width: 867px) 100vw, 867px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-6 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"875\" height=\"663\" src=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots-3.png\" alt=\"\" data-id=\"2103\" data-full-url=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots-3.png\" data-link=\"https:\/\/itsimple.info\/?attachment_id=2103\" class=\"wp-image-2103\" srcset=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots-3.png 875w, https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots-3-300x227.png 300w, https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots-3-768x582.png 768w, https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots-3-131x98.png 131w\" sizes=\"auto, (max-width: 875px) 100vw, 875px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-7 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"877\" height=\"660\" src=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots-4.png\" alt=\"\" data-id=\"2104\" data-full-url=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots-4.png\" data-link=\"https:\/\/itsimple.info\/?attachment_id=2104\" class=\"wp-image-2104\" srcset=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots-4.png 877w, https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots-4-300x226.png 300w, https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots-4-768x578.png 768w, https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/Merge-Hyper-V-Snapshots-4-131x98.png 131w\" sizes=\"auto, (max-width: 877px) 100vw, 877px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p>If the directory is full with this kind of snapshot the manual way can be hard and long, yet I have found a nice script written by Steve Williams that merge all the disk to there parent disk one by one all the way to the end, you need to run it when the VM is off (<strong>and having a backup for the VM , because you can never know<\/strong> <strong>!!!<\/strong>) I recommend to run it with the powershell editor :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Clear-Host\n\n    # Written by Steve Williams, Infotect Design Solutions, 2-11-2019\n    #\n    # Set the folder to search for newest file\n   # FolderPath is the location of the main VHDX and AVHDX files\n    $FolderPath = \"Your VM Name\\Virtual Hard Disks\\\"\n   # ActiveVM is the first few letters of the VHDX name\n    $ActiveVM = \"IIS-Server\"\n    $LoopCtr = 0\n   # PrefixLen is the length of ActiveVM variable (character length)\n    $PrefixLen = 10\n\n    # use Get-ChildItem to search folder. Note the Sort and Select\n    $currfile1 = gci -Path $FolderPath -File | Sort-Object -Property LastWriteTime -Descending | Select Name -First 1 \n\n    # Write to screen       \n    $currfile1.Name\n    $gofile = $currfile1.Name\n    if($currfile1.Name.Substring(0,$PrefixLen) -match $ActiveVM) {\n\n        Do {\n            write-host \"Running disk merge...\"\n            Write-host \"\"\n            write-host \"Attempting merge on\" $gofile\n            Write-host \"\"\n            gci -path $FolderPath -File | Sort-Object -Property LastWriteTime -Descending | Select FullName, LastWriteTime -First 1\n            # CHANGE THE PATH BELOW TO YOUR VM PATH\n            Merge-VHD -Path $FolderPath\\$gofile -Force\n            Write-Host \"Pausing for 5 seconds...\"; start-sleep (5); Write-Host \"Resuming...\"\n            $currfile1 = gci -Path $FolderPath -File | Sort-Object -Property LastWriteTime -Descending | Select Name -First 1\n            $gofile = $currfile1.Name\n            $LoopCtr++\n            write-host \"Loops Completed:\" $LoopCtr \n        } while($currfile1.Name.Substring(0,$PrefixLen) -match $ActiveVM)\n    } else {\n        write-host \"Stop running the script, the latest drive file is not matching.\"\n    }\n    write-host \"DONE!\"<\/code><\/pre>\n\n\n\n<p>You can download a sample script from <strong><a href=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/MergeDiskByPernertPath.zip\" data-type=\"URL\" data-id=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/MergeDiskByPernertPath.zip\">here<\/a><\/strong>, just change the variables :<\/p>\n\n\n\n<p><a href=\"https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/MergeDiskByPernertPath.zip\">https:\/\/itsimple.info\/wp-content\/uploads\/2021\/12\/MergeDiskByPernertPath.zip<\/a><\/p>\n\n\n\n<figure class=\"wp-block-pullquote\"><blockquote class=\"has-text-color has-vivid-green-cyan-color\"><p>Good Luck<\/p><\/blockquote><\/figure>\n\n\n\n<p> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hyper-v can create checkpoint \/ Snapshot in many ways, sometime removing them can be a pain in the A&#8230; Especially if they have been created by 3rd party software. The simple way to remove snapshot is through the Hyper-v manager, just click on the VM and in the checkpoint window delete the checkpoint : Some [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,12,18,14,15],"tags":[],"class_list":["post-2095","post","type-post","status-publish","format-standard","hentry","category-hyper-v","category-tutorials","category-virtualization","category-windows","category-windows-server"],"_links":{"self":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts\/2095","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2095"}],"version-history":[{"count":0,"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts\/2095\/revisions"}],"wp:attachment":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2095"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2095"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}