<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Sig-I/O (Posts about sata)</title><link>https://sig-io.nl/</link><description></description><atom:link href="https://sig-io.nl/categories/sata.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2024 &lt;a href="mailto:mark@sig-io.nl"&gt;Mark Janssen&lt;/a&gt; </copyright><lastBuildDate>Sun, 21 Jul 2024 15:45:30 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Resetting failed drive in linux mdadm raid array</title><link>https://sig-io.nl/posts/resetting-failed-drive-in-linux-mdadm-raid-array/</link><dc:creator>Mark Janssen</dc:creator><description>&lt;p&gt;Today I was greeted with a failed drive in a mdadm raid array. The drive had some transient errors and was kicked out of the array, but testing showed that the drive still seemed to work just fine.&lt;/p&gt;
&lt;figure&gt;
&lt;a class="reference external image-reference" href="https://sig-io.nl/images/harddisks.jpg"&gt;
&lt;img alt="Harddisks" src="https://sig-io.nl/images/harddisks.thumbnail.jpg"&gt;
&lt;/a&gt;
&lt;figcaption&gt;
&lt;p&gt;Image by Martin Abegglen (&lt;a class="reference external" href="https://www.flickr.com/photos/twicepix/3333710952"&gt;https://www.flickr.com/photos/twicepix/3333710952&lt;/a&gt;)&lt;/p&gt;
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;The following procedure will remove the drive from the array, remove it from the system, re-probe for disks, and then re-add the drive back into the array(s).&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;Remove the failed drive from the array, in this case, it was /dev/sdb:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;mdadm --manage --set-faulty /dev/md0 /dev/sdb1&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make sure nothing on this disk is being used (mounts, other arrays, etc)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reseat the drive from the system, either physically, or using the following commands:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;echo 1 &amp;gt; /sys/block/sdb/device/delete&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;echo "- - -" &amp;gt; /sys/class/scsi_host/host1/scan&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check if the drive is found again, and check if it works correctly&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;check dmesg output, or look at /proc/partitions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;try running: ‘pv &amp;lt; /dev/sdb of=/dev/zero‘&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Re-add the drive to the array(s)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;mdadm /dev/md0 -a /dev/sdb1&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;cat /proc/mdstat&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That should do the trick…&lt;/p&gt;</description><category>drive</category><category>linux</category><category>mdadm</category><category>raid</category><category>reset</category><category>sata</category><guid>https://sig-io.nl/posts/resetting-failed-drive-in-linux-mdadm-raid-array/</guid><pubDate>Thu, 12 Apr 2012 21:05:19 GMT</pubDate></item></channel></rss>