{"id":464,"date":"2019-10-24T10:26:02","date_gmt":"2019-10-24T17:26:02","guid":{"rendered":"http:\/\/blog.nillsf.com\/?p=464"},"modified":"2019-10-24T11:06:32","modified_gmt":"2019-10-24T18:06:32","slug":"taking-a-disk-snapshot-and-mounting-that-to-a-new-vm","status":"publish","type":"post","link":"https:\/\/blog.nillsf.com\/index.php\/2019\/10\/24\/taking-a-disk-snapshot-and-mounting-that-to-a-new-vm\/","title":{"rendered":"Taking a Disk Snapshot and mounting that to a new VM"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">If you need to move large amounts of data from 1 VM in Azure to another VM, a easy way to move that data is rather than copying the individual files, you could take a disk snapshot, and then mount the snapshot to a new VM.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I had this proposal in a customer scenario recently, where we needed to move large files from a Windows Machine to a Linux Machine (SLES15).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s walk through it:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Test infrastructure<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I have the following infrastructure:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Windows VM, running 2016<\/li><li>Suse VM, running sles 15.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">I mounted a 2TB premium disk to my Windows VM, and have 2 files there: a sort of large files (ubuntu ISO) and a text file (saying hello to myself). None of these disks are encrypted. <\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"487\" src=\"\/wp-content\/uploads\/2019\/10\/image-43-1024x487.png\" alt=\"\" class=\"wp-image-466\" srcset=\"https:\/\/nillsfblog.blob.core.windows.net\/media\/2019\/10\/image-43-1024x487.png 1024w, https:\/\/nillsfblog.blob.core.windows.net\/media\/2019\/10\/image-43-300x143.png 300w, https:\/\/nillsfblog.blob.core.windows.net\/media\/2019\/10\/image-43-768x365.png 768w, https:\/\/nillsfblog.blob.core.windows.net\/media\/2019\/10\/image-43.png 1156w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"781\" height=\"306\" src=\"\/wp-content\/uploads\/2019\/10\/image-42.png\" alt=\"\" class=\"wp-image-465\" srcset=\"https:\/\/nillsfblog.blob.core.windows.net\/media\/2019\/10\/image-42.png 781w, https:\/\/nillsfblog.blob.core.windows.net\/media\/2019\/10\/image-42-300x118.png 300w, https:\/\/nillsfblog.blob.core.windows.net\/media\/2019\/10\/image-42-768x301.png 768w\" sizes=\"auto, (max-width: 781px) 100vw, 781px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The SUSE VM is running nothing special, just the OS disk for now.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Creating the snapshot, creating a disk, mounting the disk to the new VM<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">We need to execute three steps to copy that disk to our new VM.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First step is taking the snapshot. <strong>Recommendation for production use cases<\/strong> here is to shutdown the source VM to avoid any data corruption. If you cannot shut down the source, make sure you&#8217;re not writing any files to disk when taking the snapshot to avoid corruption.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To take the snapshot, head over to the disk in Azure, and hit the Create Snapshot button.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"731\" height=\"320\" src=\"\/wp-content\/uploads\/2019\/10\/image-44.png\" alt=\"\" class=\"wp-image-467\" srcset=\"https:\/\/nillsfblog.blob.core.windows.net\/media\/2019\/10\/image-44.png 731w, https:\/\/nillsfblog.blob.core.windows.net\/media\/2019\/10\/image-44-300x131.png 300w\" sizes=\"auto, (max-width: 731px) 100vw, 731px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Follow the instructions in the next pane to create the snapshot.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"759\" height=\"500\" src=\"\/wp-content\/uploads\/2019\/10\/image-45.png\" alt=\"\" class=\"wp-image-468\" srcset=\"https:\/\/nillsfblog.blob.core.windows.net\/media\/2019\/10\/image-45.png 759w, https:\/\/nillsfblog.blob.core.windows.net\/media\/2019\/10\/image-45-300x198.png 300w\" sizes=\"auto, (max-width: 759px) 100vw, 759px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Creating the snapshot takes about a minute or less. When the snapshot is taking, we&#8217;ll create a new disk. Go into your target VM blade (suse in my case), open the disks blade, and hit the edit button. In the bottom you&#8217;ll see, Add Data disks, click that and then hit &#8220;Create new Disk&#8221;.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"827\" height=\"545\" src=\"\/wp-content\/uploads\/2019\/10\/image-46.png\" alt=\"\" class=\"wp-image-469\" srcset=\"https:\/\/nillsfblog.blob.core.windows.net\/media\/2019\/10\/image-46.png 827w, https:\/\/nillsfblog.blob.core.windows.net\/media\/2019\/10\/image-46-300x198.png 300w, https:\/\/nillsfblog.blob.core.windows.net\/media\/2019\/10\/image-46-768x506.png 768w\" sizes=\"auto, (max-width: 827px) 100vw, 827px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Fill in the right details to create your disk. Make sure to select source type as Snapshot and refer to your existing snapshot. <\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"744\" height=\"617\" src=\"\/wp-content\/uploads\/2019\/10\/image-47.png\" alt=\"\" class=\"wp-image-470\" srcset=\"https:\/\/nillsfblog.blob.core.windows.net\/media\/2019\/10\/image-47.png 744w, https:\/\/nillsfblog.blob.core.windows.net\/media\/2019\/10\/image-47-300x249.png 300w\" sizes=\"auto, (max-width: 744px) 100vw, 744px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">When the disk is created &#8211; takes a couple of seconds &#8211; hit the save button in the disks blade of the VM.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Mounting the VM in SUSE<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Login to your SUSE VM (SSH), and execute the following commands:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo su\nlsblk<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">in the output, you should see all your disks. Note the name of your disk that came from Windows. In my case that was <code>\/dev\/sdc1<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"474\" height=\"280\" src=\"\/wp-content\/uploads\/2019\/10\/image-48.png\" alt=\"\" class=\"wp-image-471\" srcset=\"https:\/\/nillsfblog.blob.core.windows.net\/media\/2019\/10\/image-48.png 474w, https:\/\/nillsfblog.blob.core.windows.net\/media\/2019\/10\/image-48-300x177.png 300w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">After that, we&#8217;ll install an NTFS driver, and them mount our disk:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>**Note: I am running SLES15 and will use a SLES15 repo. If you&#8217;re running a different version of SLES,<a href=\"https:\/\/software.opensuse.org\/download.html?project=filesystems&amp;package=ntfs-3g\"> add the repo for your version<\/a>.<\/em><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>zypper addrepo https:\/\/download.opensuse.org\/repositories\/filesystems\/SLE_15_SP1\/filesystems.repo\n#you'll get a question, reply with 'a'\nzypper refresh\nzypper search ntfs\nzypper install ntfs-3g\nmkdir \/fromwindows\nmount \/dev\/sdc1 \/fromwindows\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">With that done, we should see the content of our text file.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"535\" height=\"82\" src=\"\/wp-content\/uploads\/2019\/10\/image-49.png\" alt=\"\" class=\"wp-image-472\" srcset=\"https:\/\/nillsfblog.blob.core.windows.net\/media\/2019\/10\/image-49.png 535w, https:\/\/nillsfblog.blob.core.windows.net\/media\/2019\/10\/image-49-300x46.png 300w\" sizes=\"auto, (max-width: 535px) 100vw, 535px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you need to copy very large files between two VMs, taking a disk snapshot might be a lot quicker than doing a network copy. This even works when copying\/remounting from Windows to Linux machines (proven here from Windows 2016 to SLES15).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you need to move large amounts of data from 1 VM in Azure to another VM, a easy way to move that data is rather than copying the individual files, you could take a disk snapshot, and then mount the snapshot to a new VM. I had this proposal in a customer scenario recently, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-464","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.nillsf.com\/index.php\/wp-json\/wp\/v2\/posts\/464","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.nillsf.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.nillsf.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.nillsf.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.nillsf.com\/index.php\/wp-json\/wp\/v2\/comments?post=464"}],"version-history":[{"count":2,"href":"https:\/\/blog.nillsf.com\/index.php\/wp-json\/wp\/v2\/posts\/464\/revisions"}],"predecessor-version":[{"id":474,"href":"https:\/\/blog.nillsf.com\/index.php\/wp-json\/wp\/v2\/posts\/464\/revisions\/474"}],"wp:attachment":[{"href":"https:\/\/blog.nillsf.com\/index.php\/wp-json\/wp\/v2\/media?parent=464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.nillsf.com\/index.php\/wp-json\/wp\/v2\/categories?post=464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.nillsf.com\/index.php\/wp-json\/wp\/v2\/tags?post=464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}