{"id":7842,"date":"2019-06-28T01:39:11","date_gmt":"2019-06-28T00:39:11","guid":{"rendered":"https:\/\/stevepedwards.today\/DebianAdmin\/?p=7842"},"modified":"2023-08-06T03:50:50","modified_gmt":"2023-08-06T02:50:50","slug":"quickest-cloning-of-working-mint-system","status":"publish","type":"post","link":"https:\/\/stevepedwards.today\/DebianAdmin\/quickest-cloning-of-working-mint-system\/","title":{"rendered":"Quickest Cloning of Working Mint System"},"content":{"rendered":"<div class=\"pvc_clear\"><\/div><p id=\"pvc_stats_7842\" class=\"pvc_stats all  \" data-element-id=\"7842\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p><div class=\"pvc_clear\"><\/div><p>The only command I know of that clones an active system drive is DD, but it is very slow at about 30GB \/ hr, system specs depending..it can do this unlike <span style=\"color: #0000ff;\">rsync<\/span> or <span style=\"color: #0000ff;\">cp -vr<\/span> because it doesn't get stopped by it's own process in \/proc or \/sys.<\/p>\r\n<p>The fastest way I have found to get another clone of your perfectly setup system is by fresh installing a new system on a new drive from USB install image (10 mins), then using rsync as below to update the missing files from your system drive to the clone. This means MYSQL DB's, updates, home dirs etc. can be transferred as rsync's default is to copy newer files over old ones and as most of your working system's files don't yet exist on the new install, they get transferred also.<\/p>\r\n<p>After you have fresh installed from USB image to the clone drive, do the full updates to your <strong>working system<\/strong> so your files are definitely newer or the same versions as the new drive install (don't update the new install!!), or use an older installed version from your spare backup drives and mount that on the working system you want to clone.\u00a0<\/p>\r\n<p>All files from the fully working system drive will transfer to the clone-to-be using rsync except those in <strong>bold<\/strong> (assuming your spare drive is mounted at \/media\/home\/user, so it doesn't loop copy \/media\/home\/user files over and over until full!).<\/p>\r\n<p>The excluded are in bold, and {-n=dry-run} ALWAYS!:<\/p>\r\n<p><span style=\"color: #0000ff;\">sudo rsync \/* \/media\/stevee\/1586c82b-01d5-46cb-822d-81dbe57c5951\/ --exclude=<strong>{dev,media,proc,run,sys,tmp}<\/strong> -vahn --update<\/span><\/p>\r\n<p><!-- \/wp:post-content -->\r\n\r\n<!-- wp:paragraph {\"textColor\":\"bright-blue\"} --><\/p>\r\n<p>The update switch only updates newer files on the source.<\/p>\r\n<p>Note! the UUID number of the system drive will be copied to GRUB \/boot\/grub\/grub.cfg file and \/etc\/fstab.<\/p>\r\n<p>Change them before you boot the new drive as it will now have the UUID value of the cloned drive!<\/p>\r\n<p><!-- \/wp:paragraph -->\r\n\r\n<!-- wp:paragraph {\"textColor\":\"bright-blue\"} --><\/p>\r\n<p class=\"has-text-color has-bright-blue-color\"><span style=\"color: #0000ff;\">sudo blkid<\/span><\/p>\r\n<p><!-- \/wp:paragraph -->\r\n\r\n<!-- wp:paragraph {\"textColor\":\"bright-red\"} --><\/p>\r\n<p class=\"has-text-color has-bright-red-color\"><span style=\"color: #ff0000;\">\/dev\/sdb1: UUID=\"1341613a-6c85-4b03-837e-d0636ecf6adb\" TYPE=\"ext4\" PARTUUID=\"f4b5a292-01\"<\/span><\/p>\r\n<p>It's EASY to edit grub's files in vim:<\/p>\r\n<p>Replace all cloned drive UUIDs in \/the new drive's \/etc\/fstab and \/boot\/grub\/grub.cfg with the new drive's UUID:<\/p>\r\n<p><span style=\"color: #0000ff;\">sudo vi \/media\/stevee\/de1ea326-7478-4297-8bce-79cb77d682c9\/boot\/grub\/grub.cfg<\/span><\/p>\r\n<p>In vim, press : then add at the :<\/p>\r\n<p><span style=\"color: #0000ff;\">:%s\/oldstring\/newstring\/g<\/span><\/p>\r\n<p>g for global means substitute <strong>every<\/strong> occurrence of \"oldstring\" on <strong>every<\/strong> line.<\/p>\r\n<p><span style=\"color: #0000ff;\">sudo vi \/media\/stevee\/de1ea326-7478-4297-8bce-79cb77d682c9\/etc\/fstab<\/span><\/p>\r\n<p><!-- \/wp:paragraph -->\r\n\r\n<!-- wp:paragraph \/-->\r\n\r\n<!-- wp:paragraph --><\/p>\r\n<p>OR you can edit the GRUB boot menu of the new drive by BIOS booting to it then pressing E at the GRUB menu and removing all references to UUIDs and replace with root=\/dev\/sdb1 format and change the relevant (hd0,1) formats to the correct partition values and boot with F10 ensuring to <span style=\"color: #0000ff;\">sudo update-grub2<\/span> once the new drive has booted correctly.<\/p>\r\n<p>IF you did not set the GRUB install on a multi drive system to the correct install drive, and it defaulted to \/dev\/sda, then you can install GRUB on any drive with:<\/p>\r\n<p><span style=\"color: #0000ff;\">sudo grub-install.real \/dev\/sdb<\/span><\/p>\r\n<p>If short on space upgrading the target drive:<\/p>\r\n<p><span style=\"color: #0000ff;\">sudo rsync \/* \/media\/stevee\/f92a3d3c-adf4-48e0-8964-83f2b52e251c\/ -vah --delete-before --delete-excluded --exclude={dev,media,proc,run,sys,tmp}<\/span><\/p>","protected":false},"excerpt":{"rendered":"<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_7842\" class=\"pvc_stats all  \" data-element-id=\"7842\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/stevepedwards.today\/DebianAdmin\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n<p>The only command I know of that clones an active system drive is DD, but it is very slow at about 30GB \/ hr, system specs depending..it can do this unlike rsync or cp -vr because it doesn't get stopped by it's own process in \/proc or \/sys. The fastest way I have found to <a href=\"https:\/\/stevepedwards.today\/DebianAdmin\/quickest-cloning-of-working-mint-system\/\" class=\"more-link\">...<span class=\"screen-reader-text\">\u00a0 Quickest Cloning of Working Mint System<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7842","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"a3_pvc":{"activated":true,"total_views":6,"today_views":0},"_links":{"self":[{"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/posts\/7842","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/comments?post=7842"}],"version-history":[{"count":2,"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/posts\/7842\/revisions"}],"predecessor-version":[{"id":9834,"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/posts\/7842\/revisions\/9834"}],"wp:attachment":[{"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/media?parent=7842"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/categories?post=7842"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stevepedwards.today\/DebianAdmin\/wp-json\/wp\/v2\/tags?post=7842"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}