{"id":1493,"date":"2022-09-08T05:14:45","date_gmt":"2022-09-08T08:14:45","guid":{"rendered":"https:\/\/blog.abratel.com.br\/?p=1493"},"modified":"2022-09-08T05:17:05","modified_gmt":"2022-09-08T08:17:05","slug":"clonar-hd-com-linux-dd","status":"publish","type":"post","link":"https:\/\/blog.abratel.com.br\/?p=1493","title":{"rendered":"Clonar HD com Linux DD"},"content":{"rendered":"<p>Simple copying one SSD to another one. Make sure about the sda and the sdb for not clone on oposite way, somentimes the sdb is the main one:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ndd if=\/dev\/sda of=\/dev\/sdb bs=32M\n<\/pre>\n<p>Some blogs says to add status=progress for see the progress but I never tested.<\/p>\n<p>==========================================<\/p>\n<p>Skipping the erros:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ndd if=\/dev\/sda of=\/dev\/sdb bs=4096 conv=sync,noerror\n<\/pre>\n<p>This will copy the disk, and skip blocks with errors, which is very important.<br \/>\nThese are the basic and essential options for using dd to clone or rescue a disk.<\/p>\n<p>=========================================<br \/>\nExport and after import:<\/p>\n<p>To save space, you can compress data produced by dd with gzip, e.g.:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ndd if=\/dev\/hdb | gzip -c  &amp;gt; \/image.img.gz\n<\/pre>\n<p>You can restore your disk with:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ngunzip -c \/image.img.gz | dd of=\/dev\/hdb\n<\/pre>\n<p>To save even more space, defragment the drive\/partition you wish to clone beforehand (if appropriate), then zero-out all the remaining unused space, making it easier for gzip to compress:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nmkdir \/mnt\/hdb\nmount \/dev\/hdb \/mnt\/hdb\ndd if=\/dev\/zero of=\/mnt\/hdb\/zero\n<\/pre>\n<p>Wait a bit, dd will eventually fail with a &#8220;disk full&#8221; message, then:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nrm \/mnt\/hdb\/zero\numount \/mnt\/hdb\ndd if=\/dev\/hdb | gzip -c  &amp;gt; \/image.img.gz\n<\/pre>\n<p>Also, you can get a dd process running in the background to report status by sending it a signal with the kill command, e.g.:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ndd if=\/dev\/hdb of=\/image.img &amp;amp;\nkill -SIGUSR1 1234\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Simple copying one SSD to another one. Make sure about the sda and the sdb for not clone on oposite way, somentimes the sdb is the main one: Some blogs says to add status=progress for see the progress but I never tested. ========================================== Skipping the&#8230;<\/p>\n","protected":false},"author":1,"featured_media":1502,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/posts\/1493"}],"collection":[{"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1493"}],"version-history":[{"count":6,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/posts\/1493\/revisions"}],"predecessor-version":[{"id":1506,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/posts\/1493\/revisions\/1506"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/media\/1502"}],"wp:attachment":[{"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}