{"id":3816,"date":"2025-10-18T11:57:26","date_gmt":"2025-10-18T10:57:26","guid":{"rendered":"https:\/\/kudzia.eu\/b\/?p=3816"},"modified":"2025-10-18T12:38:33","modified_gmt":"2025-10-18T11:38:33","slug":"forcing-rewrite-of-one-of-mdadm-raid1-disks","status":"publish","type":"post","link":"https:\/\/kudzia.eu\/b\/2025\/10\/forcing-rewrite-of-one-of-mdadm-raid1-disks\/","title":{"rendered":"forcing rewrite of one of mdadm raid1 disks"},"content":{"rendered":"\n<p>on not so important server i got an alert about SMART errors and failing weekly surface test [ <em>smartctl -d sat -t long \/dev\/sdb<\/em> ].<\/p>\n\n\n\n<p>i wanted to force the drive to re-allocate bad sectors; i could not read it anymore &#8211; <em>cat \/dev\/sdb &gt; \/dev\/null <\/em>would fail with read errors. i remember reading somewhere that drive will mark bad sectors and on attempt of rewriting them &#8211; will use reserved capacity and re-allocate them. so i&#8217;ve forced the data to be rewritten by:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#removing write intent - to force full rewrite of the drive\nmdadm --grow \/dev\/md0 --bitmap=none\n#failing and removing problematic partition from my raid1\nmdadm --manage --set-faulty \/dev\/md0 \/dev\/sdb2\nmdadm --manage \/dev\/md0 -r \/dev\/sdb2\n#adding it again which forces rewrite based on the other drive in this RAID1\nmdadm --manage \/dev\/md0 --add \/dev\/sdb2\n#re-enabling write intent bitmap\nmdadm --grow --bitmap=internal \/dev\/md0\n<\/code><\/pre>\n\n\n\n<p>interestingly &#8211; it worked; i can  <em>cat \/dev\/sdb &gt; \/dev\/null <\/em> without errors. obviously this drive will be replaced anyway.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>on not so important server i got an alert about SMART errors and failing weekly surface test [ smartctl -d sat -t long \/dev\/sdb ]. i wanted to force the drive to re-allocate bad sectors; i could not read it anymore &#8211; cat \/dev\/sdb &gt; \/dev\/null would fail with read errors. i remember reading somewhere [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[51],"tags":[6,108],"class_list":["post-3816","post","type-post","status-publish","format-standard","hentry","category-unimportant","tag-linux","tag-mdadm"],"_links":{"self":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/3816","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/comments?post=3816"}],"version-history":[{"count":2,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/3816\/revisions"}],"predecessor-version":[{"id":3818,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/3816\/revisions\/3818"}],"wp:attachment":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/media?parent=3816"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/categories?post=3816"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/tags?post=3816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}