<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" ><channel><title>Kevin Deldycke &#187; HDD</title> <atom:link href="http://kevin.deldycke.com/tag/hard-disk-drive/feed/" rel="self" type="application/rss+xml" /><link>http://kevin.deldycke.com</link> <description>Free software engineer &#38; wannabe videomaker</description> <lastBuildDate>Fri, 03 Feb 2012 19:08:27 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Setting up HDD&#8217;s SMART monitoring on Debian Squeeze</title><link>http://kevin.deldycke.com/2011/05/setting-hdds-smart-monitoring-debian-squeeze/</link> <comments>http://kevin.deldycke.com/2011/05/setting-hdds-smart-monitoring-debian-squeeze/#comments</comments> <pubDate>Tue, 17 May 2011 10:13:04 +0000</pubDate> <dc:creator>Kev</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[HDD]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Server]]></category> <category><![CDATA[smartmontools]]></category> <category><![CDATA[squeeze]]></category><guid isPermaLink="false">http://kevin.deldycke.com/?p=3169</guid> <description><![CDATA[Here is how I setup SMART monitoring and maintenance of an array of Hard-Disk Drives running a Debian Squeeze. First, let&#8217;s install the smartmontools package: We now have to check that SMART is activated on our drives: Nowadays all modern &#8230; <a href="http://kevin.deldycke.com/2011/05/setting-hdds-smart-monitoring-debian-squeeze/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>Here is how I setup SMART monitoring and maintenance of an array of Hard-Disk Drives running a Debian Squeeze.</p><p>First, let&#8217;s install the <code>smartmontools</code> package:</p><pre class="brush: bash; title: ; notranslate">
$ aptitude install smartmontools
</pre><p>We now have to check that SMART is activated on our drives:</p><pre class="brush: bash; title: ; notranslate">
$ smartctl -a /dev/sdb | grep &quot;SMART support is: Enabled&quot;
$ smartctl -a /dev/sdc | grep &quot;SMART support is: Enabled&quot;
$ smartctl -a /dev/sdd | grep &quot;SMART support is: Enabled&quot;
$ smartctl -a /dev/sde | grep &quot;SMART support is: Enabled&quot;
</pre><p>Nowadays all modern drives are already activated in factories. But in case they&#8217;re not you can activate this feature with the following command:</p><pre class="brush: bash; title: ; notranslate">
$ smartctl -s on -a /dev/sdb
</pre><p>Now we have to activate the <code>smartd</code> daemon, and let it start automatically when the machine boot:</p><pre class="brush: bash; title: ; notranslate">
$ sed -i 's/#start_smartd=yes/start_smartd=yes/g'                           /etc/default/smartmontools
$ sed -i 's/#smartd_opts=&quot;--interval=1800&quot;/smartd_opts=&quot;--interval=1800&quot;/g' /etc/default/smartmontools
</pre><p>For some reason, I prefer to not let <code>smartd</code> select by itself drives it should check. Here is how to deactivate the auto-detection:</p><pre class="brush: bash; title: ; notranslate">
$ sed -i 's/^DEVICESCAN /#DEVICESCAN /g' /etc/smartd.conf
</pre><p>Now let&#8217;s specify by hand the way our drives should be monitored and maintained. Here are the lines I added to <code>/etc/smartd.conf</code>:</p><pre class="brush: plain; title: ; notranslate">
/dev/sdb -a -o on -S on -s (S/../.././02|L/../../6/03) -m kevin@deldycke.com
/dev/sdc -a -o on -S on -s (S/../.././04|L/../../6/05) -m kevin@deldycke.com
/dev/sdd -a -o on -S on -s (S/../.././06|L/../../6/07) -m kevin@deldycke.com
/dev/sde -a -o on -S on -s (S/../.././08|L/../../6/09) -m kevin@deldycke.com
</pre><p>Finally, we need to restart the SMART service to take into account all our changes:</p><pre class="brush: plain; title: ; notranslate">
$ /etc/init.d/smartmontools restart
</pre>]]></content:encoded> <wfw:commentRss>http://kevin.deldycke.com/2011/05/setting-hdds-smart-monitoring-debian-squeeze/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Heroic journey to RAID-5 data recovery</title><link>http://kevin.deldycke.com/2008/07/heroic-journey-to-raid-5-data-recovery/</link> <comments>http://kevin.deldycke.com/2008/07/heroic-journey-to-raid-5-data-recovery/#comments</comments> <pubDate>Thu, 24 Jul 2008 21:20:27 +0000</pubDate> <dc:creator>Kev</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[array]]></category> <category><![CDATA[Backup]]></category> <category><![CDATA[disk]]></category> <category><![CDATA[drive]]></category> <category><![CDATA[Hardware]]></category> <category><![CDATA[HDD]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[mdadm]]></category> <category><![CDATA[monitoring]]></category> <category><![CDATA[RAID]]></category> <category><![CDATA[Server]]></category> <category><![CDATA[system]]></category> <category><![CDATA[UPS]]></category><guid isPermaLink="false">http://kevin.deldycke.com/?p=246</guid> <description><![CDATA[Last week there was a power grid failure which break down my server&#8217;s RAID array. I have no UPS (as I&#8217;m a skinflint) and no automatic email alerts (because I&#8217;m too lazy to set it up). As a result, for &#8230; <a href="http://kevin.deldycke.com/2008/07/heroic-journey-to-raid-5-data-recovery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>Last week there was a power grid failure which break down my server&#8217;s RAID array. I have no <a href="http://en.wikipedia.org/wiki/Uninterruptible_power_supply">UPS</a> (as I&#8217;m a skinflint) and no automatic email alerts (because I&#8217;m too lazy to set it up). As a result, for 5 days, my 3-disk <a href="http://en.wikipedia.org/wiki/RAID_5">RAID-5 array</a> was relying on only 2 disks until I noticed the issue&#8230;</p><p>By using a combination of following commands, I was soon aware of the gravity of the situation:</p><pre class="brush: bash; title: ; notranslate">
cat /proc/mdstat
mdadm --examine /dev/sda1
</pre><p>My <code>/dev/sda1</code> disk was kicked out of the array, so I did the right stuff which consisted of reconstructing the array:</p><pre class="brush: bash; title: ; notranslate">
mdadm /dev/md0 -a /dev/sda1
</pre><p>Then, in an unlucky combination of cosmic ray bombardment, spooky action at a distance and astrological misalignment, half-way to the end of the rebuilding process (which can take up to 5 hours), another disk failed ! It was late, I was tired and utterly worried about losing 1.5 To of precious data. In such a bad shape, I was afraid to worsen the situation. So I decided to shutdown the server and sleep on the problem.</p><p>The next day I tried to boot my server to find it (surprise !) stuck in the middle of the boot process, with the famous message:</p><pre class="brush: bash; title: ; notranslate">
hit control-D to continue or give root password to fix manually
</pre><p>This is &#8220;normal&#8221; as my server tried to mount the <a href="http://en.wikipedia.org/wiki/Ext3">ext3 filesystem</a> from the <code>/dev/md0</code> partition that was just assembled by <code>mdadm</code>. Of course <code>md0</code>, if assembled and available to the system, was not running because only one disk, out of three, was in a clean state.</p><p>I skip here the epic substory in which I wasted days in a search of a working keyboard, but I let you imagine how such adventures makes my week&#8230;</p><p>Eventually, I was able to analyze the situation in details. My first reflex ? Check that disks are not physically dead:</p><pre class="brush: bash; title: ; notranslate">
fdisk -l /dev/sda
fdisk -l /dev/sdb
fdisk -l /dev/sdc
</pre><p>&#8220;Linux raid partitions&#8221; (type code &#8220;<code>fd</code>&#8220;) are still there. Good. I assumed here that disks where not physically damaged. Maybe I should have looked at <a href="http://en.wikipedia.org/wiki/Self-Monitoring,_Analysis,_and_Reporting_Technology">S.M.A.R.T.</a> datas and statistics (via <a href="http://smartmontools.sourceforge.net">smartmontools</a>). But remember, I&#8217;m lazy (and a bit crazy).</p><p>The next step was to get informations about the RAID array itself using:</p><pre class="brush: bash; title: ; notranslate">
mdadm --detail /dev/md0
</pre><p>which output the status table below (probably inaccurate as I reconstructed it afterwards):</p><pre class="brush: bash; title: ; notranslate">
Number   Major   Minor   RaidDevice State
   0       0        0        0      removed
   1       0        0        1      faulty removed
   2       8       33        2      active sync   /dev/sdc1
   3       8       17        3      spare
</pre><p>What this table told us ?</p><ul><li>The array is up, but not running. One of its device (<code>sdc1</code>) was clean and active, but it&#8217;s not enough to get a working RAID-5.</li><li>My first attempt to rebuild the array lead to an unexpected result: it added <code>sda1</code> as a spare device (in slot #3).</li><li>It confirm that <code>sdb1</code> unexpectedly failed and is now in a bad state (&#8220;<code>faulty removed</code>&#8220;).</li></ul><p>Then I stopped the array and tried to fearlessly (re)assemble it using 3 differents methods:</p><pre class="brush: bash; title: ; notranslate">
mdadm -S /dev/md0
mdadm -A /dev/md0
mdadm --assemble /dev/md0 --verbose /dev/sd[abc]1
mdadm --assemble --force --scan /dev/md0 --verbose
</pre><p>It always failed with messages like:</p><pre class="brush: bash; title: ; notranslate">
mdadm: failed to RUN_ARRAY /dev/md0: Input/output error
mdadm: /dev/md0 assembled from 1 drives and 1 spare - not enough to start the array.
</pre><p>So I examined each drive from <code>mdadm</code>&#8216;s point of view:</p><pre class="brush: bash; title: ; notranslate">
mdadm -E /dev/sda1
mdadm -E /dev/sdb1
mdadm -E /dev/sdc1
mdadm -E /dev/sd[abc]1 | grep Event
</pre><p>The lastest command compare the &#8220;<code>Event</code>&#8221; attribute of all devices. It output something like:</p><pre class="brush: bash; title: ; notranslate">
Events : 0.53120
Events : 0.53108
Events : 0.53120
</pre><p>which indicate that <code>sda1</code> and <code>sdc1</code> are somewhat synced (share the same number) and <code>sdb1</code> &#8220;late&#8221; (lower number).</p><p>Here I&#8217;ve got the idea of recreating the raid array without <code>sdb1</code>, relying only on <code>sda1</code> and <code>sdc1</code>, by using the &#8220;magic&#8221; (hence dangerous) <code>--assume-clean</code> option. The latter doesn&#8217;t build, erase or initialize a new array. It just try to assemble it &#8220;as is&#8221;. Here is the command:</p><pre class="brush: bash; title: ; notranslate">
mdadm --create /dev/md0 --assume-clean --level=5 --verbose --raid-devices=3 /dev/sda1 missing /dev/sdc1
</pre><p>And it worked ! <img src='http://kevin.deldycke.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /></p><p>I mounted the <code>md0</code> partition and cleaned it up:</p><pre class="brush: bash; title: ; notranslate">
fsck.ext3 -v /dev/md0
mount /dev/md0
</pre><p>I updated my <a href="http://neil.brown.name/blog/mdadm">mdadm</a> configuration before rebooting my server:</p><pre class="brush: bash; title: ; notranslate">
mdadm --detail --scan &gt;&gt; /etc/mdadm/mdadm.conf
vi /etc/mdadm/mdadm.conf
reboot
</pre><p>But history repeat itself, and again, the system hang up during boot. Except this time I knew what was happening: the boot process detected the remaining <code>sdb1</code> device as part of the old array (the one before the regeneration I did above) and tried to run it. <a href="http://kevin.deldycke.com/2007/03/how-to-recover-a-raid-array-after-having-zero-ized-superblocks/">Remembering my last year post</a>, I zero-ized the superblock of <code>sdb1</code>:</p><pre class="brush: bash; title: ; notranslate">
mdadm -S /dev/md0
mdadm --zero-superblock /dev/sdb1
</pre><p>A server reboot proved I was right and my <code>md0</code> partition was automagically mounted in altered state:</p><pre class="brush: bash; title: ; notranslate">
localhost:~# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sdb1[3] sda1[0] sdc1[2]
      1465143808 blocks level 5, 64k chunk, algorithm 2 [3/2] [U_U]

unused devices: &lt;none&gt;
</pre><p>I just had to re-add <code>sdb1</code> to fill the available slot and update the mdadm configuration to get back my array in its initial state:</p><pre class="brush: bash; title: ; notranslate">
mdadm --manage /dev/md0 --add /dev/sdb1
mdadm --detail --scan &gt;&gt; /etc/mdadm/mdadm.conf
vi /etc/mdadm/mdadm.conf
</pre>]]></content:encoded> <wfw:commentRss>http://kevin.deldycke.com/2008/07/heroic-journey-to-raid-5-data-recovery/feed/</wfw:commentRss> <slash:comments>10</slash:comments> </item> <item><title>Hardware commands</title><link>http://kevin.deldycke.com/2006/12/hardware-commands/</link> <comments>http://kevin.deldycke.com/2006/12/hardware-commands/#comments</comments> <pubDate>Wed, 06 Dec 2006 21:18:55 +0000</pubDate> <dc:creator>Kev</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[CLI]]></category> <category><![CDATA[Hardware]]></category> <category><![CDATA[HDD]]></category> <category><![CDATA[kernel]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[MBR]]></category> <category><![CDATA[partitions]]></category> <category><![CDATA[X.org]]></category><guid isPermaLink="false">http://kevin.deldycke.com/2006/12/usefull-commands-hardware/</guid> <description><![CDATA[Change the keyboard layout in Debian (don&#8217;t forget to logoff and logon to activate the new setting): Low-level format of the hda device: Same as above but for paranoïd, as random bits will be written 3 times before performing the &#8230; <a href="http://kevin.deldycke.com/2006/12/hardware-commands/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<ul><li>Change the keyboard layout in Debian (don&#8217;t forget to logoff and logon to activate the new setting):<pre class="brush: bash; title: ; notranslate">
dpkg-reconfigure keyboard-configuration
</pre></li><li>Low-level format of the <code>hda</code> device:<pre class="brush: bash; title: ; notranslate">
dd if=/dev/zero of=/dev/hda
</pre></li><li>Same as above but for paranoïd, as random bits will be written 3 times before performing the &#8220;low-level format&#8221; (i.e. writting zeros):<pre class="brush: bash; title: ; notranslate">
shred --verbose --force --iterations=3 --zero /dev/hda
</pre></li><li>Remove the MBR:<pre class="brush: bash; title: ; notranslate">
dd if=/dev/null of=/dev/hda bs=446 count=1
</pre></li><li>Restore the original Windows MBR:<pre class="brush: bash; title: ; notranslate">
apt-get install mbr
install-mbr -i n -p D -t 0 /dev/hda
</pre></li><li>To add touchpad kernel support, add the following option to kernel at boot time:<pre class="brush: bash; title: ; notranslate">
psmouse.proto=imps
</pre></li><li>Sometimes, depending of the laptop I use, the mouse pointer disappear from the screen when I plug a VGA cable to a projector. In this case, I do a <code>CTRL + ALT + F1</code>, then I login as a normal user and finally I start a new X session:<pre class="brush: bash; title: ; notranslate">
startx -- :1
</pre></li></ul> ]]></content:encoded> <wfw:commentRss>http://kevin.deldycke.com/2006/12/hardware-commands/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 2/22 queries in 0.009 seconds using apc
Object Caching 685/724 objects using apc

Served from: kevin.deldycke.com @ 2012-02-08 11:09:30 -->
