{"id":54,"date":"2009-05-10T14:43:09","date_gmt":"2009-05-10T12:43:09","guid":{"rendered":"http:\/\/46.105.150.90\/tstnunix\/?p=54"},"modified":"2009-05-10T14:43:09","modified_gmt":"2009-05-10T12:43:09","slug":"smart-take-the-control","status":"publish","type":"post","link":"https:\/\/nunix.fr\/?p=54","title":{"rendered":"SMART &#8211; Take the control"},"content":{"rendered":"<p>Sometimes, you&rsquo;re hard drive isn&rsquo;t working as you expect. Or sometimes, you wonder if your hard drive is in good health. Since 2003, manufacturers integrate a system to monitor predictable failures directly on hard drive.It helps companies, but also individuals to be alerted when the hard disk goes to death! A good guide to understand what is predictable or not : <a href=\"http:\/\/www.pctechguide.com\/31HardDisk_SMART.htm\">PC Tech Guide.<\/a><\/p>\n<p>This technology, S.M.A.R.T (Self-Monitoring, Analysis and Reporting Technology) is embedded on the device. We&rsquo;ll explain how to get enable S.M.A.R.T. on hard drives, then check the disk to get errors.<\/p>\n<p>In the following example, let assume the device we need to check is <strong>\/dev\/sda<\/strong><\/p>\n<ul>\n<li>\n<h1>Install &#8211; if you don&rsquo;t have it<\/h1>\n<\/li>\n<\/ul>\n<pre># apt-get install smartmontools <\/pre>\n<ul>\n<li>\n<h1>Check the status<\/h1>\n<\/li>\n<\/ul>\n<pre># smartctl -i \/dev\/sda <br \/>smartctl version 5.37 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen<br \/>Home page is http:\/\/smartmontools.sourceforge.net\/<br \/><br \/>=== START OF INFORMATION SECTION ===<br \/>Model Family:     Maxtor DiamondMax Plus 9 family<br \/>Device Model:     Maxtor 6Y080M0<br \/><\/pre>\n<p> <!--more--> <\/p>\n<pre>Serial Number:    Y213233E<br \/>Firmware Version: YAR51EW0<br \/>User Capacity:    81 964 302 336 bytes<br \/>Device is:        In smartctl database [for details use: -P show]<br \/>ATA Version is:   7<br \/>ATA Standard is:  ATA\/ATAPI-7 T13 1532D revision 0<br \/>Local Time is:    Mon Jan  5 22:58:26 2009 CET<br \/>SMART support is: Available - device has SMART capability.<br \/>SMART support is: Enabled<\/pre>\n<p>The important lines are the two last. Lucky us, the drive support SMART technology. As SMART has been widely spreed, most of current hard drive should support this technology. But some old drives don&rsquo;t support it : to check health, search with &lsquo;testdisk&rsquo;. <\/p>\n<ul>\n<li>\n<h1>Activate or deactivate the SMART utility<\/h1>\n<\/li>\n<\/ul>\n<pre># smartctl -s on -d ata \/dev\/sda<br \/># smartctl -s off -d ata \/dev\/sda<\/pre>\n<ul>\n<li>\n<h1>Update information<\/h1>\n<\/li>\n<\/ul>\n<p>There is three basic categories of testing. Quoting the man :\u00a0 <\/p>\n<ul>\n<li>The first category, called \u00ab\u00a0online\u00a0\u00bb testing, has no effect on the performance of the device. <\/li>\n<li>The second category of testing is called \u00ab\u00a0offline\u00a0\u00bb testing. This type of test can, in principle, degrade the device performance.<\/li>\n<li>The third category of testing (and the only category for which the word \u00b4testing\u00b4 is really an appropriate choice) is \u00ab\u00a0self\u00a0\u00bb testing.<\/li>\n<\/ul>\n<p>The difference among these categories will be the behavior to update information. Check the man, with option -o to know what you prefer. In our case, we want to run a test NOW, so we use the option -t, or &#8211;test. We use the value \u00ab\u00a0offline\u00a0\u00bb to update the data, but we could have put \u00ab\u00a0short\u00a0\u00bb to run a short test, or another value. Again, the best resource is the man.<br \/>The offline test will proceed inspection of the hard drive, and report errors in log we will display later. Finally, this command indicates how many times we have to wait before inspection end.<\/p>\n<pre>#smartctl -t offline \/dev\/sda<br \/>smartctl version 5.37 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen<br \/>Home page is http:\/\/smartmontools.sourceforge.net\/<br \/><br \/>=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===<br \/>Sending command: \"Execute SMART off-line routine immediately in off-line mode\".<br \/>Drive command \"Execute SMART off-line routine immediately in off-line mode\" successful.<br \/>Testing has begun.<br \/>Please wait 241 seconds for test to complete.<br \/>Test will complete after Mon Jan  5 22:51:54 2009<\/pre>\n<p>In our case, the test was on 241 seconds. You can interrupt the SMART offline test with the option -X (smartctl -X).\u00a0<\/p>\n<ul>\n<li>\n<h1>Get back disk status<\/h1>\n<\/li>\n<\/ul>\n<p>To make simple, we just display all information with the -a option. But you could determine what is really important by trying the option -l (or &#8211;log). See the manpages if you need more information. <\/p>\n<pre> #smartctl -a \/dev\/sda <\/pre>\n<p>The result is really verbose, so we won&rsquo;t show it.  <\/p>\n<ul>\n<li>\n<h1>I&rsquo;m in hurry, give me the test result, quick!<\/h1>\n<\/li>\n<\/ul>\n<p>\u00a0To know if your disk status is well, just run the command below<\/p>\n<pre>#smartctl -H \/dev\/sda<br \/>\u00a0smartctl version 5.37 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen<br \/>Home page is http:\/\/smartmontools.sourceforge.net\/<br \/><br \/>=== START OF READ SMART DATA SECTION ===<br \/>SMART overall-health self-assessment test result: PASSED<br \/><\/pre>\n<p>And in one line it will tell you if the test succeed or not.<\/p>\n<ul>\n<li>\n<h1>\u00a0A daemon?<\/h1>\n<\/li>\n<\/ul>\n<p>To be alerted in errors, or for your status, the package smartmontools include a daemon : smartd.\u00a0<\/p>\n<p>You can edit the configuration file to manage what kind of alert you want to receive, Edit the file \/etc\/smartd.conf which is really verbose.\u00a0 <\/p>\n<p>I hope it will help someone to manage your hd status quickly.<\/p>\n<p>Gabriel {jcomments on}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes, you&rsquo;re hard drive isn&rsquo;t working as you expect. Or sometimes, you wonder if your hard drive is in good health. Since 2003, manufacturers integrate a system to monitor predictable failures directly on hard drive.It helps companies, but also individuals to be alerted when the hard disk goes to death! A good guide to understand &hellip; <a href=\"https:\/\/nunix.fr\/?p=54\" class=\"more-link\">Continuer la lecture<span class=\"screen-reader-text\"> de &laquo;&nbsp;SMART &#8211; Take the control&nbsp;&raquo;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-54","post","type-post","status-publish","format-standard","hentry","category-administration"],"_links":{"self":[{"href":"https:\/\/nunix.fr\/index.php?rest_route=\/wp\/v2\/posts\/54","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nunix.fr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nunix.fr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nunix.fr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nunix.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=54"}],"version-history":[{"count":0,"href":"https:\/\/nunix.fr\/index.php?rest_route=\/wp\/v2\/posts\/54\/revisions"}],"wp:attachment":[{"href":"https:\/\/nunix.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=54"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nunix.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=54"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nunix.fr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=54"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}