{"id":319,"date":"2019-01-22T16:05:20","date_gmt":"2019-01-23T00:05:20","guid":{"rendered":"https:\/\/angrysysadmins.tech\/?p=319"},"modified":"2019-10-11T18:38:05","modified_gmt":"2019-10-12T02:38:05","slug":"copy-a-hard-drive-to-any-vm-anywhere-with-ssh","status":"publish","type":"post","link":"https:\/\/angrysysadmins.tech\/index.php\/2019\/01\/grassyloki\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\/","title":{"rendered":"Copy a Hard Drive to Any VM Anywhere with SSH"},"content":{"rendered":"<p>Have you ever wanted to import an OVA into services like Linode, Vultr, AWS, and others? Have you ever wanted to get your VM off of one of those services? Well let me introduce the magic of SSH, dd, and Gzip.<\/p>\n<p>&nbsp;<\/p>\n<p>To get started, you need to boot Linux on both VM&#8217;s and have root access. To make it easy, you can boot Ubuntu live CD&#8217;s on them. The machine you are copying to (the new one) needs to be accessible on the open internet.<\/p>\n<p>&nbsp;<\/p>\n<p>On the live CD on the new machine, type the following:<br \/>\n<code>sudo -i<br \/>\npasswd<\/code><br \/>\nAnd input a somewhat secure password.<\/p>\n<p>&nbsp;<\/p>\n<p>Next, edit the sshd config to allow root login:<br \/>\n<code>nano \/etc\/ssh\/sshd_config<\/code><br \/>\nThen set<br \/>\n<code>PermitRootLogin yes<\/code><br \/>\nSave and exit with control+x.<\/p>\n<p>&nbsp;<\/p>\n<p>Next, start the SSH daemon:<br \/>\n<code>systemctl start sshd<\/code><\/p>\n<p>Now you should be able to connect to the new machine. On the old machine, try to ssh in to the box with the root user and the password you set.<\/p>\n<p>&nbsp;<\/p>\n<p>Next, you need to check the drive labels for both the old and the new machine, <code>fdisk -l<\/code> will help you with that. Finally, on the old machine, run this long command, and it will begin the disk transfer:<\/p>\n<p>&nbsp;<\/p>\n<p><code>dd if=\/dev\/OldDrive | gzip -c | ssh root@NewIP 'gunzip - | dd of=\/dev\/NewDrive status=progress'<\/code><\/p>\n<p>&nbsp;<\/p>\n<p>Once it&#8217;s done, you should be able to boot that machine.<\/p>\n<p>&nbsp;<\/p>\n<p>Bootloaders can potentially end up causing problems. If the old machine is UEFI, the new one will have to be as well or it won&#8217;t boot. BIOS to UEFI will *probably* work, but could end up causing its own set of problems. If you clone the disk and it does not boot properly at first, see if you have the ability\u00a0 Another thing to keep in mind is what virtualization technology your hosting provider is using, so that you can install the proper drivers and\/or guest agent for that provider.<\/p>\n<hr \/>\n<p>You can also clone the old disk to an img file, which can then be read to other disks later. This can be done by modifying the above command slightly to be:<\/p>\n<p><code>dd if=\/dev\/OldDrive | gzip -c | ssh NewComputer@NewIP 'gunzip - | dd of=\/path\/somewhere\/clone.img status=progress'<\/code><\/p>\n<p>You can also do this the other direction, with the new machine connecting to the old one:<\/p>\n<p><code>ssh root@OldIP 'dd if=\/dev\/OldDrive | gzip -c' | gunzip - | dd of=\/path\/somewhere\/clone.img status=progress<\/code><\/p>\n<p>Giving dd the .img file as the input will allow you to restore from this backup. I recommend gzip-ing it if you plan to keep it for a while.<\/p>\n<p>If you have issues or questions, feel free to post below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever wanted to import an OVA into services like Linode, Vultr, AWS, and others? Have you ever wanted to get your VM off of one of those services? Well let me introduce the magic of SSH, dd, and Gzip. &nbsp; To get started, you need to boot Linux on both VM&#8217;s and have <br \/><a class=\"read-more-button\" href=\"https:\/\/angrysysadmins.tech\/index.php\/2019\/01\/grassyloki\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\/\">Read More &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,21,22,11,66],"tags":[],"coauthors":[39,37],"class_list":["post-319","post","type-post","status-publish","format-standard","hentry","category-linux","category-ovirt","category-virtualization","category-vmware","category-xen"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Copy a Hard Drive to Any VM Anywhere with SSH - Angry Sysadmins<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/angrysysadmins.tech\/index.php\/2019\/01\/grassyloki\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Copy a Hard Drive to Any VM Anywhere with SSH - Angry Sysadmins\" \/>\n<meta property=\"og:description\" content=\"Have you ever wanted to import an OVA into services like Linode, Vultr, AWS, and others? Have you ever wanted to get your VM off of one of those services? Well let me introduce the magic of SSH, dd, and Gzip. &nbsp; To get started, you need to boot Linux on both VM&#8217;s and have Read More &raquo;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/angrysysadmins.tech\/index.php\/2019\/01\/grassyloki\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\/\" \/>\n<meta property=\"og:site_name\" content=\"Angry Sysadmins\" \/>\n<meta property=\"article:published_time\" content=\"2019-01-23T00:05:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-10-12T02:38:05+00:00\" \/>\n<meta name=\"author\" content=\"Ryan Parker, Cat Kasin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ryan Parker, Cat Kasin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/angrysysadmins.tech\\\/index.php\\\/2019\\\/01\\\/grassyloki\\\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/angrysysadmins.tech\\\/index.php\\\/2019\\\/01\\\/grassyloki\\\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\\\/\"},\"author\":{\"name\":\"Ryan Parker\",\"@id\":\"https:\\\/\\\/angrysysadmins.tech\\\/#\\\/schema\\\/person\\\/651321cd35645fb6a4d8a75b7bc7c199\"},\"headline\":\"Copy a Hard Drive to Any VM Anywhere with SSH\",\"datePublished\":\"2019-01-23T00:05:20+00:00\",\"dateModified\":\"2019-10-12T02:38:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/angrysysadmins.tech\\\/index.php\\\/2019\\\/01\\\/grassyloki\\\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\\\/\"},\"wordCount\":405,\"commentCount\":1,\"articleSection\":[\"Linux\",\"oVirt\",\"Virtualization\",\"VMware\",\"Xen\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/angrysysadmins.tech\\\/index.php\\\/2019\\\/01\\\/grassyloki\\\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/angrysysadmins.tech\\\/index.php\\\/2019\\\/01\\\/grassyloki\\\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\\\/\",\"url\":\"https:\\\/\\\/angrysysadmins.tech\\\/index.php\\\/2019\\\/01\\\/grassyloki\\\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\\\/\",\"name\":\"Copy a Hard Drive to Any VM Anywhere with SSH - Angry Sysadmins\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/angrysysadmins.tech\\\/#website\"},\"datePublished\":\"2019-01-23T00:05:20+00:00\",\"dateModified\":\"2019-10-12T02:38:05+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/angrysysadmins.tech\\\/#\\\/schema\\\/person\\\/651321cd35645fb6a4d8a75b7bc7c199\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/angrysysadmins.tech\\\/index.php\\\/2019\\\/01\\\/grassyloki\\\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/angrysysadmins.tech\\\/index.php\\\/2019\\\/01\\\/grassyloki\\\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/angrysysadmins.tech\\\/index.php\\\/2019\\\/01\\\/grassyloki\\\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/angrysysadmins.tech\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Copy a Hard Drive to Any VM Anywhere with SSH\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/angrysysadmins.tech\\\/#website\",\"url\":\"https:\\\/\\\/angrysysadmins.tech\\\/\",\"name\":\"Angry Sysadmins\",\"description\":\"A site full of angry sysadmins here to vent and help\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/angrysysadmins.tech\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/angrysysadmins.tech\\\/#\\\/schema\\\/person\\\/651321cd35645fb6a4d8a75b7bc7c199\",\"name\":\"Ryan Parker\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fc12b1a02765c8017062ee6f41eb34a7b14575bcd8acd7da40e176fe8f12b10f?s=96&d=mm&r=g664d0e05248e51cb1d71b3f66c6f929d\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fc12b1a02765c8017062ee6f41eb34a7b14575bcd8acd7da40e176fe8f12b10f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fc12b1a02765c8017062ee6f41eb34a7b14575bcd8acd7da40e176fe8f12b10f?s=96&d=mm&r=g\",\"caption\":\"Ryan Parker\"},\"description\":\"Professionally im a Infrastructure Security Specialist. I current maintain a homelab with about 3TB of RAM, 240+ TB of storage, tons of CPU cores, and 100gbit networking backbone in the garage running up my electricity bill.\",\"url\":\"https:\\\/\\\/angrysysadmins.tech\\\/index.php\\\/author\\\/grassyloki\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Copy a Hard Drive to Any VM Anywhere with SSH - Angry Sysadmins","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/angrysysadmins.tech\/index.php\/2019\/01\/grassyloki\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\/","og_locale":"en_US","og_type":"article","og_title":"Copy a Hard Drive to Any VM Anywhere with SSH - Angry Sysadmins","og_description":"Have you ever wanted to import an OVA into services like Linode, Vultr, AWS, and others? Have you ever wanted to get your VM off of one of those services? Well let me introduce the magic of SSH, dd, and Gzip. &nbsp; To get started, you need to boot Linux on both VM&#8217;s and have Read More &raquo;","og_url":"https:\/\/angrysysadmins.tech\/index.php\/2019\/01\/grassyloki\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\/","og_site_name":"Angry Sysadmins","article_published_time":"2019-01-23T00:05:20+00:00","article_modified_time":"2019-10-12T02:38:05+00:00","author":"Ryan Parker, Cat Kasin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Ryan Parker, Cat Kasin","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/angrysysadmins.tech\/index.php\/2019\/01\/grassyloki\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\/#article","isPartOf":{"@id":"https:\/\/angrysysadmins.tech\/index.php\/2019\/01\/grassyloki\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\/"},"author":{"name":"Ryan Parker","@id":"https:\/\/angrysysadmins.tech\/#\/schema\/person\/651321cd35645fb6a4d8a75b7bc7c199"},"headline":"Copy a Hard Drive to Any VM Anywhere with SSH","datePublished":"2019-01-23T00:05:20+00:00","dateModified":"2019-10-12T02:38:05+00:00","mainEntityOfPage":{"@id":"https:\/\/angrysysadmins.tech\/index.php\/2019\/01\/grassyloki\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\/"},"wordCount":405,"commentCount":1,"articleSection":["Linux","oVirt","Virtualization","VMware","Xen"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/angrysysadmins.tech\/index.php\/2019\/01\/grassyloki\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/angrysysadmins.tech\/index.php\/2019\/01\/grassyloki\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\/","url":"https:\/\/angrysysadmins.tech\/index.php\/2019\/01\/grassyloki\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\/","name":"Copy a Hard Drive to Any VM Anywhere with SSH - Angry Sysadmins","isPartOf":{"@id":"https:\/\/angrysysadmins.tech\/#website"},"datePublished":"2019-01-23T00:05:20+00:00","dateModified":"2019-10-12T02:38:05+00:00","author":{"@id":"https:\/\/angrysysadmins.tech\/#\/schema\/person\/651321cd35645fb6a4d8a75b7bc7c199"},"breadcrumb":{"@id":"https:\/\/angrysysadmins.tech\/index.php\/2019\/01\/grassyloki\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/angrysysadmins.tech\/index.php\/2019\/01\/grassyloki\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/angrysysadmins.tech\/index.php\/2019\/01\/grassyloki\/copy-a-hard-drive-to-any-vm-anywhere-with-ssh\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/angrysysadmins.tech\/"},{"@type":"ListItem","position":2,"name":"Copy a Hard Drive to Any VM Anywhere with SSH"}]},{"@type":"WebSite","@id":"https:\/\/angrysysadmins.tech\/#website","url":"https:\/\/angrysysadmins.tech\/","name":"Angry Sysadmins","description":"A site full of angry sysadmins here to vent and help","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/angrysysadmins.tech\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/angrysysadmins.tech\/#\/schema\/person\/651321cd35645fb6a4d8a75b7bc7c199","name":"Ryan Parker","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/fc12b1a02765c8017062ee6f41eb34a7b14575bcd8acd7da40e176fe8f12b10f?s=96&d=mm&r=g664d0e05248e51cb1d71b3f66c6f929d","url":"https:\/\/secure.gravatar.com\/avatar\/fc12b1a02765c8017062ee6f41eb34a7b14575bcd8acd7da40e176fe8f12b10f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/fc12b1a02765c8017062ee6f41eb34a7b14575bcd8acd7da40e176fe8f12b10f?s=96&d=mm&r=g","caption":"Ryan Parker"},"description":"Professionally im a Infrastructure Security Specialist. I current maintain a homelab with about 3TB of RAM, 240+ TB of storage, tons of CPU cores, and 100gbit networking backbone in the garage running up my electricity bill.","url":"https:\/\/angrysysadmins.tech\/index.php\/author\/grassyloki\/"}]}},"_links":{"self":[{"href":"https:\/\/angrysysadmins.tech\/index.php\/wp-json\/wp\/v2\/posts\/319","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/angrysysadmins.tech\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/angrysysadmins.tech\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/angrysysadmins.tech\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/angrysysadmins.tech\/index.php\/wp-json\/wp\/v2\/comments?post=319"}],"version-history":[{"count":13,"href":"https:\/\/angrysysadmins.tech\/index.php\/wp-json\/wp\/v2\/posts\/319\/revisions"}],"predecessor-version":[{"id":697,"href":"https:\/\/angrysysadmins.tech\/index.php\/wp-json\/wp\/v2\/posts\/319\/revisions\/697"}],"wp:attachment":[{"href":"https:\/\/angrysysadmins.tech\/index.php\/wp-json\/wp\/v2\/media?parent=319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/angrysysadmins.tech\/index.php\/wp-json\/wp\/v2\/categories?post=319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/angrysysadmins.tech\/index.php\/wp-json\/wp\/v2\/tags?post=319"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/angrysysadmins.tech\/index.php\/wp-json\/wp\/v2\/coauthors?post=319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}