{"id":1948,"date":"2023-12-06T23:18:45","date_gmt":"2023-12-06T22:18:45","guid":{"rendered":"http:\/\/michlstechblog.info\/blog\/?p=1948"},"modified":"2024-07-23T22:56:24","modified_gmt":"2024-07-23T20:56:24","slug":"linux-disk-recovery-with-ddrescue","status":"publish","type":"post","link":"https:\/\/michlstechblog.info\/blog\/linux-disk-recovery-with-ddrescue\/","title":{"rendered":"Linux: Disk recovery with ddrescue"},"content":{"rendered":"<div class=\"twoclick_social_bookmarks_post_1948 social_share_privacy clearfix 1.6.4 locale-en_US sprite-en_US\"><\/div><div class=\"twoclick-js\"><script type=\"text\/javascript\">\/* <![CDATA[ *\/\njQuery(document).ready(function($){if($('.twoclick_social_bookmarks_post_1948')){$('.twoclick_social_bookmarks_post_1948').socialSharePrivacy({\"services\":{\"flattr\":{\"uid\":\"Michl\",\"status\":\"on\",\"the_title\":\"Linux%3A%20Disk%20recovery%20with%20ddrescue\",\"the_excerpt\":\"Hi%0D%0A%0D%0A%27ddrescue%20--direct%27%20will%20open%20the%20input%20with%20the%20O_DIRECT%20option%20for%20uncached%20reads.%20%27raw%20devices%27%20are%20not%20needed%20on%20newer%20kernels.%20For%20older%20kernels%20see%20below.%0D%0A%20%28more%26hellip%3B%29\",\"txt_info\":\"2 clicks for more data protection:\\r\\n\\r\\nOnly when you click here, the button will be come active and you can send your recommendation to Flattr. When activating, data are transmitted to third parties. \",\"perma_option\":\"off\"}},\"txt_help\":\"When you activate these fields by clicking, information to Flattr may be transferred abroad, and probably may also stored there.\",\"settings_perma\":\"Enable permanently and accept data transmission. \",\"info_link\":\"http:\\\/\\\/www.heise.de\\\/ct\\\/artikel\\\/2-Klicks-fuer-mehr-Datenschutz-1333879.html\",\"uri\":\"https:\\\/\\\/michlstechblog.info\\\/blog\\\/linux-disk-recovery-with-ddrescue\\\/\",\"post_id\":1948,\"post_title_referrer_track\":\"Linux%3A+Disk+recovery+with+ddrescue\",\"display_infobox\":\"on\"});}});\n\/* ]]> *\/<\/script><\/div><p>Hi<\/p>\n<p>&#8216;ddrescue &#8211;direct&#8217; will open the input with the O_DIRECT option for uncached reads. &#8216;raw devices&#8217; are not needed on newer kernels. For older kernels see below.<br \/>\n<!--more--><br \/>\nFirst you copy as much data as possible, without retrying or splitting sectors:<\/p>\n<p><!--ddrescue --no-split \/dev\/hda1 imagefile logfile--><br \/>\n<!-- https:\/\/de.wikipedia.org\/wiki\/Ddrescue --> <\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nddrescue -f -n \/dev\/hda1 imagefile logfile\r\n<\/pre>\n<p>Now let it retry previous errors 3 times, using uncached reads:<\/p>\n<p><!-- ddrescue --direct --max-retries=3 \/dev\/hda1 imagefile logfile --><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nddrescue -d -f -r3 \/dev\/hda1 imagefile logfile\r\n<\/pre>\n<p>If that fails you can try again but retrimmed, so it tries to reread full sectors:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nddrescue --direct --retrim --max-retries=3 \/dev\/hda1 imagefile logfile\r\n<\/pre>\n<p>Example 3: Rescue an entire hard disk \/dev\/sda to another disk \/dev\/sdb<\/p>\n<p>copy the error free areas first<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nddrescue -n \/dev\/sda \/dev\/sdb rescue.log\r\n<\/pre>\n<p>attempt to recover any bad sectors<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nddrescue -r 1 \/dev\/sda \/dev\/sdb rescue.log\r\n<\/pre>\n<p>Michael <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi &#8216;ddrescue &#8211;direct&#8217; will open the input with the O_DIRECT option for uncached reads. &#8216;raw devices&#8217; are not needed on newer kernels. For older kernels see below.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,466],"tags":[2023,199,2022,224,945,20],"class_list":["post-1948","post","type-post","status-publish","format-standard","hentry","category-linux","category-security","tag-ddrescue","tag-disk","tag-failure","tag-linux-2","tag-recovery","tag-windows-2"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/1948","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/comments?post=1948"}],"version-history":[{"count":10,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/1948\/revisions"}],"predecessor-version":[{"id":9810,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/1948\/revisions\/9810"}],"wp:attachment":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/media?parent=1948"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/categories?post=1948"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/tags?post=1948"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}