{"id":3313,"date":"2015-08-05T15:58:52","date_gmt":"2015-08-05T13:58:52","guid":{"rendered":"https:\/\/contabo.com\/blog\/?p=3313"},"modified":"2021-12-21T12:53:39","modified_gmt":"2021-12-21T11:53:39","slug":"check-disks-health-linux-smartmontools","status":"publish","type":"post","link":"https:\/\/contabo.com\/blog\/check-disks-health-linux-smartmontools\/","title":{"rendered":"How to check the health of your hard drive with smartmontools (in Linux)"},"content":{"rendered":"<h2 class=\"western\" align=\"left\"><span style=\"font-size: large;\"><b>A) Installation<\/b><\/span><\/h2>\n<p>If you\u2019re not sure about your admin rights, always enter the command sudo -i at the beginning of every session:<\/p>\n<blockquote><p><strong>sudo -i<\/strong><\/p><\/blockquote>\n<p>This command will grant you the rights of a power user, so you don\u2019t have to write the command sudo at the beginning of every command line.<\/p>\n<p>To install smartmontools please type the following:<\/p>\n<p>-Debian and Ubuntu-<\/p>\n<blockquote><p><strong>apt update &amp;&amp; apt install smartmontools<\/strong><\/p><\/blockquote>\n<p>-CentOS-<\/p>\n<blockquote><p><strong>yum install smartmontools<\/strong><\/p><\/blockquote>\n<p>The above commands will install smartmontools on your system.<\/p>\n<p><span style=\"font-size: large;\"><b>B) How to use smartmontools<\/b><\/span><\/p>\n<p>At first, you have to determine the label of your disks. To do so please type the following:<\/p>\n<blockquote><p><strong>fdisk -l<\/strong><\/p><\/blockquote>\n<p>It will look similar to this:<\/p>\n<blockquote><p>Disk <strong><span style=\"color: #ff6600;\">\/dev\/hda<\/span><\/strong>: 160.0 GB, 160041885696 bytes<br \/>\n255 heads, 63 sectors\/track, 19457 cylinders<br \/>\nUnits = cylinders of 16065 * 512 = 8225280 bytes<\/p>\n<p>Device Boot Start End Blocks Id System<br \/>\n\/dev\/sda1 * 1 19269 154778211 83 Linux<br \/>\n\/dev\/sda2 19270 19457 1510110 5 Extended<br \/>\n\/dev\/sda5 19270 19457 1510078+ 82 Linux swap \/ Solaris<br \/>\nsystem1:~#<\/p><\/blockquote>\n<p>In this case the disk has the label &#8216;<strong><span style=\"color: #ff6600;\">\/dev\/hda<\/span><\/strong>&#8216;. Apart from &#8220;hdX&#8221;, you will often encounter &#8220;sdX&#8221;. It does not make sense to use smartmontools to test a RAID array (\/dev\/md0, for example).<\/p>\n<p>With the information of the disks label, we can start smartctl as follows:<\/p>\n<blockquote><p><strong>smartctl -a \/dev\/hda<\/strong><\/p><\/blockquote>\n<p>The output will look something like this:<\/p>\n<blockquote><p>system1:~# smartctl -a \/dev\/hda<br \/>\nsmartctl version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen<br \/>\nHome page is http:\/\/smartmontools.sourceforge.net\/<\/p>\n<p>=== START OF INFORMATION SECTION ===<br \/>\nDevice Model: ST3160022ACE<br \/>\nSerial Number: 5JS3XTZX<br \/>\nFirmware Version: 9.01<br \/>\nUser Capacity: 160,041,885,696 bytes<br \/>\nDevice is: Not in smartctl database [for details use: -P showall]<br \/>\nATA Version is: 6<\/p>\n<p>ATA Standard is: ATA\/ATAPI-6 T13 1410D revision 2<br \/>\nLocal Time is: Tue Apr 8 18:58:44 2008 CEST<br \/>\nSMART support is: Available &#8211; device has SMART capability.<br \/>\n<span style=\"color: #ff6600;\"><strong>SMART<\/strong><\/span> support is: <span style=\"color: #ff6600;\"><strong>Disabled<\/strong><\/span><\/p>\n<p>SMART Disabled. Use option -s with argument &#8216;on&#8217; to enable it.<br \/>\nsystem1:~#<\/p><\/blockquote>\n<p><strong>SMART<\/strong> is disabled in this example. To enable it, please type:<\/p>\n<blockquote><p><strong>smartctl -s on -a \/dev\/hda<\/strong><\/p><\/blockquote>\n<p>The output will be a detailed report of your disks current status and health, that would look similar to this:<\/p>\n<blockquote><p>system1:~# smartctl -s on -a \/dev\/hda<br \/>\nsmartctl version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen<br \/>\nHome page is http:\/\/smartmontools.sourceforge.net\/<\/p>\n<p>=== START OF INFORMATION SECTION ===<br \/>\nDevice Model: ST3160022ACE<br \/>\nSerial Number: 5JS3XTZX<br \/>\nFirmware Version: 9.01<br \/>\nUser Capacity: 160,041,885,696 bytes<br \/>\nDevice is: Not in smartctl database [for details use: -P showall]<br \/>\nATA Version is: 6<br \/>\nATA Standard is: ATA\/ATAPI-6 T13 1410D revision 2<br \/>\nLocal Time is: Tue Apr 8 18:59:14 2008 CEST<br \/>\nSMART support is: Available &#8211; device has SMART capability.<br \/>\nSMART support is: Disabled<\/p>\n<p>=== START OF ENABLE\/DISABLE COMMANDS SECTION ===<br \/>\n<strong><span style=\"color: #ff6600;\">SMART Enabled<\/span>.<\/strong><\/p>\n<p>=== START OF READ SMART DATA SECTION ===<br \/>\n<strong>SMART overall-health self-assessment test result: <span style=\"color: #ff6600;\">PASSED<\/span><\/strong><\/p>\n<p>General SMART Values:<br \/>\nOffline data collection status: (0x82) Offline data collection activity<br \/>\nwas completed <span style=\"color: #ff6600;\"><strong>without error<\/strong><\/span>.<br \/>\nAuto Offline Data Collection: Enabled.<br \/>\nSelf-test execution status: ( 0) The previous self-test routine completed<br \/>\nwithout error or no self-test has ever<br \/>\nbeen run.<br \/>\nTotal time to complete Offline<br \/>\ndata collection: (15556) seconds.<br \/>\nOffline data collection<br \/>\ncapabilities: (0x5b) SMART execute Offline immediate.<br \/>\nAuto Offline data collection on\/off support.<br \/>\nSuspend Offline collection upon new<br \/>\ncommand.<br \/>\nOffline surface scan supported.<br \/>\nSelf-test supported.<br \/>\nNo Conveyance Self-test supported.<br \/>\nSelective Self-test supported.<br \/>\nSMART capabilities: (0x0003) Saves SMART data before entering<br \/>\npower-saving mode.<br \/>\nSupports SMART auto save timer.<br \/>\nError logging capability: (0x01) Error logging supported.<br \/>\nGeneral Purpose Logging supported.<br \/>\nShort self-test routine<br \/>\nrecommended polling time: ( 1) minutes.<br \/>\nExtended self-test routine<br \/>\nrecommended polling time: ( 111) minutes.<\/p>\n<p>SMART Attributes Data Structure revision number: 10<br \/>\nVendor Specific SMART Attributes with Thresholds:<br \/>\nID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE<br \/>\n1 Raw_Read_Error_Rate 0x000f 059 056 006 Pre-fail Always &#8211; 163692057<br \/>\n3 Spin_Up_Time 0x0003 096 096 000 Pre-fail Always &#8211; 0<br \/>\n4 Start_Stop_Count 0x0032 100 100 020 Old_age Always &#8211; 0<br \/>\n5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always &#8211; 0<br \/>\n7 Seek_Error_Rate 0x000f 100 253 030 Pre-fail Always &#8211; 722959<br \/>\n9 Power_On_Hours 0x0032 100 100 000 Old_age Always &#8211; 55<br \/>\n10 Spin_Retry_Count 0x0013 100 100 097 Pre-fail Always &#8211; 0<br \/>\n12 Power_Cycle_Count 0x0032 100 100 020 Old_age Always &#8211; 37<br \/>\n194 Temperature_Celsius 0x0022 039 046 000 Old_age Always &#8211; 39<br \/>\n195 Hardware_ECC_Recovered 0x001a 059 056 000 Old_age Always &#8211; 163692057<br \/>\n197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always &#8211; 0<br \/>\n198 Offline_Uncorrectable 0x0010 100 100 000 Old_age Offline &#8211; 0<br \/>\n199 UDMA_CRC_Error_Count 0x003e 200 199 000 Old_age Always &#8211; 0<br \/>\n200 Multi_Zone_Error_Rate 0x0000 100 253 000 Old_age Offline &#8211; 0<br \/>\n202 TA_Increase_Count 0x0032 100 253 000 Old_age Always &#8211; 0<\/p>\n<p>SMART Error Log Version: 1<br \/>\n<strong>ATA Error Count: <span style=\"color: #ff6600;\">0<\/span><\/strong><br \/>\nCR = Command Register [HEX]<br \/>\nFR = Features Register [HEX]<br \/>\nSC = Sector Count Register [HEX]<br \/>\nSN = Sector Number Register [HEX]<br \/>\nCL = Cylinder Low Register [HEX]<br \/>\nCH = Cylinder High Register [HEX]<br \/>\nDH = Device\/Head Register [HEX]<br \/>\nDC = Device Command Register [HEX]<br \/>\nER = Error register [HEX]<br \/>\nST = Status register [HEX]<br \/>\nPowered_Up_Time is measured from power on, and printed as<br \/>\nDDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,<br \/>\nSS=sec, and sss=millisec. It &#8220;wraps&#8221; after 49.710 days.<\/p>\n<p>SMART Selective self-test log data structure revision number 1<br \/>\nSPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS<br \/>\n1 0 0 Not_testing<br \/>\n2 0 0 Not_testing<br \/>\n3 0 0 Not_testing<br \/>\n4 0 0 Not_testing<br \/>\n5 0 0 Not_testing<br \/>\nSelective self-test flags (0x0):<br \/>\nAfter scanning selected spans, do NOT read-scan remainder of disk.<br \/>\nIf Selective self-test is pending on power-up, resume after 0 minute delay.<\/p>\n<p>system1:~#<\/p><\/blockquote>\n<p>In this example the disk is currently healthy and has no recorded errors. All important values have been highlighted in orange in this example for your convenience. To find out more about the capabilities of smartmontools, please refer to the smartctl manual page by typing:<\/p>\n<blockquote><p><strong>man smartctl<\/strong><\/p><\/blockquote>\n<p><span style=\"text-decoration: underline;\">Some S.M.A.R.T. values you should look out for:<\/span><\/p>\n<p><strong><em>Reallocated_Sector_Count<\/em><\/strong><\/p>\n<p>Anything else than &#8216;0&#8217; is bad. The severity of the disk damage depends on when the drive got the reallocated sectors and how long ago. If the last bad sector was reallocated one year ago the disk is in no immediate danger, as the problem has appeared, been fixed and has not come back. If a bad sector shows up, you will likely get more over time and the general statistic is that a disk that starts to get bad sectors will be defective within six months.<\/p>\n<p><em><strong>Current_Pending_Sector<\/strong> <\/em><\/p>\n<p>This means that sectors are awaiting an upcoming recheck to see if there really is a problem. One encounters these when the operating system is broken and the disk already has a few bad sectors.<\/p>\n<p><em><strong>Offline_Uncorrectable<\/strong><\/em><\/p>\n<p>The disk is most likely in a bad health state, but this only becomes certain with more writes.<\/p>\n<p><em><strong>UDMA_CRC_Count<\/strong><\/em><\/p>\n<p>This can be a serious problem and is generally due to defective cables. Simply replacing the cable will be sufficient since the hard disk itself is not affected. If the data cable has been checked and the error persists, there are only a couple of other options. The motherboard or disk are causing &#8216;soft faults&#8217;. We recommend to have your server checked completely in this case.<\/p>\n<p><strong>Please keep in mind that using smartmontools or memtest on a VPS will always show wrong results, due to the fact that the hardware is per definition virtualized. Rest assured that Contabo will always check the health of all disks on the VPS host-systems. You will not need to check this for yourself.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A) Installation If you\u2019re not sure about your admin rights, always enter the command sudo -i at the beginning of every session: sudo -i This command will grant you the rights of a power user, so you don\u2019t have to write the command sudo at the beginning of every command line. To install smartmontools please [&hellip;]<\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[18],"tags":[405,406,411,510,724,768,855,889,894],"ppma_author":[1497],"class_list":["post-3313","post","type-post","status-publish","format-standard","hentry","category-tutorials","tag-hard-drive","tag-hard-drive-health","tag-hdd","tag-linux","tag-s-m-a-r-t","tag-smartmontools","tag-ultravnc","tag-vnc","tag-vps"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Philipp","author_link":"https:\/\/contabo.com\/blog\/author\/philipp\/"},"uagb_comment_info":0,"uagb_excerpt":"A) Installation If you\u2019re not sure about your admin rights, always enter the command sudo -i at the beginning of every session: sudo -i This command will grant you the rights of a power user, so you don\u2019t have to write the command sudo at the beginning of every command line. To install smartmontools please&hellip;","authors":[{"term_id":1497,"user_id":19,"is_guest":0,"slug":"philipp","display_name":"Philipp","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/01f728f9df51b69e518e9e4812905f84fcf3758571bbd7ea0b2e0722d96333d1?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/posts\/3313","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/comments?post=3313"}],"version-history":[{"count":0,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/posts\/3313\/revisions"}],"wp:attachment":[{"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/media?parent=3313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/categories?post=3313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/tags?post=3313"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/contabo.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=3313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}