{"id":5,"date":"2010-09-25T00:11:03","date_gmt":"2010-09-25T00:11:03","guid":{"rendered":"http:\/\/sobell.com\/mgsblog\/?p=5"},"modified":"2010-10-18T17:46:30","modified_gmt":"2010-10-19T00:46:30","slug":"fun-with-hdparm","status":"publish","type":"post","link":"https:\/\/sobell.com\/mgsblog\/archives\/5","title":{"rendered":"Fun with hdparm!"},"content":{"rendered":"<p>The <strong>hdparm<\/strong> utility reports on and set device parameters. This blog explains a few of the <strong>hdparm<\/strong> options\u2014see the man page for more options and details.<\/p>\n<p><strong>CAUTION<\/strong>: You can wreak havoc on a disk with some <strong>hdparm<\/strong> commands. You can wipe a disk with a <strong>hdparm<\/strong> Secure Erase command (see <a title=\"ATA Secure Erase\" href=\"https:\/\/ata.wiki.kernel.org\/index.php\/ATA_Secure_Erase\" target=\"_blank\">https:\/\/ata.wiki.kernel.org\/index.php\/ATA_Secure_Erase<\/a>). Use this utility with caution.<\/p>\n<p>If you want more information than this blog hosts, see the <strong>hdparm<\/strong> <a href=\"http:\/\/manpages.ubuntu.com\/manpages\/lucid\/man8\/hdparm.8.html\/\">man page<\/a>, <a href=\"http:\/\/freshmeat.net\/projects\/hdparm\/\">http:\/\/freshmeat.net\/projects\/hdparm\/<\/a>, and <a href=\"http:\/\/sourceforge.net\/projects\/hdparm\/\">http:\/\/sourceforge.net\/projects\/hdparm\/<\/a>.<\/p>\n<p>In the following examples,<strong> \/dev\/sdf<\/strong> is a Hitachi 1TB drive model HDS721010CLA332.<\/p>\n<h3>Display General Information<\/h3>\n<p>The <strong>\u2013I<\/strong> option displays information about a drive. Add <strong>\u2013 \u2013verbose<\/strong> for even more information.<\/p>\n<pre><code>$ <strong>sudo hdparm -I \/dev\/sdf | head -20<\/strong>\r\n\/dev\/sdf:\r\nATA device, with non-removable media\r\n        Model Number:       Hitachi HDS721010CLA332\r\n        Serial Number:      JP2921HQ049J1A\r\n        Firmware Revision:  JP4OA25C\r\n        Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6; Revision: ATA8-AST T13 Project D1697 Revision 0b\r\nStandards:\r\n        Used: unknown (minor revision code 0x0029)\r\n        Supported: 8 7 6 5\r\n        Likely used: 8\r\nConfiguration:\r\n        Logical         max     current\r\n        cylinders       16383   16383\r\n        heads           16      16\r\n        sectors\/track   63      63\r\n        --\r\n        CHS current addressable sectors:   16514064\r\n        LBA    user addressable sectors:  268435455<\/code><\/pre>\n<p>With the <strong>\u2013H<\/strong> option, <strong>hdparm<\/strong> displays the temperature of the drive you specify as an argument. It also tells you whether the drive temperature is in a safe range, which may not be accurate. This option works for Hitachi drives and may work for some others.<\/p>\n<pre><code>$<strong> sudo hdparm -H \/dev\/sdf<\/strong>\r\n\/dev\/sdf:\r\n  drive temperature (celsius) is:  29\r\n  drive temperature in range:  yes<\/code><\/pre>\n<h3>Control Power Settings<\/h3>\n<p>The <strong>\u2013C<\/strong> option displays the power setting of the drive:<\/p>\n<pre><code>mark@tea:~$ <strong>sudo hdparm -C \/dev\/sd[ef]<\/strong>\r\n\/dev\/sde:\r\n drive state is:  active\/idle\r\n\/dev\/sdf:\r\n drive state is:  standby<\/code><\/pre>\n<p>Although the man page refers to a sleep and a standby mode, I could get my drive to report only standby. The <strong>\u2013Y<\/strong> option is supposed to put a drive into the lowest power mode (sleep), which means it shuts down completely. The <strong>\u2013y<\/strong> option is supposed to put a drive into the low power mode (standby), which usually means it spins down.<\/p>\n<pre><code>$mark@tea:~$<strong> sudo hdparm -C \/dev\/sdf<\/strong>\r\n\/dev\/sdf:\r\n drive state is:  active\/idle\r\nmark@tea:~$<strong> sudo hdparm -Y \/dev\/sdf<\/strong>\r\n\/dev\/sdf:\r\n issuing sleep command\r\nmark@tea:~$ <strong>sudo hdparm -C \/dev\/sdf<\/strong>\r\n\/dev\/sdf:\r\n drive state is:  standby<\/code><\/pre>\n<p>Before testing another option, I spin up the hard drive by listing a directory on the hard drive. Five-ten seconds elapse before the listing appears, confirming the drive was spun-down. If you do not see this pause, the drive is not spun-down or you are reading from cache.<\/p>\n<pre><code>mark@tea:~$ <strong>ls -l \/backup\/bu1\/*\/p01.26<\/strong>\r\n...\r\nmark@tea:~$ <strong>sudo hdparm -C \/dev\/sdf<\/strong>\r\n\/dev\/sdf:\r\n drive state is:  active\/idle\r\n&gt;&gt;&gt; Mon 17:05\r\nmark@tea:~$<strong> sudo hdparm -y \/dev\/sdf<\/strong>\r\n\/dev\/sdf:\r\n issuing standby command\r\n&gt;&gt;&gt; Mon 17:05\r\nmark@tea:~$ <strong>sudo hdparm -C \/dev\/sdf<\/strong>\r\n\/dev\/sdf:\r\n drive state is:  standby<\/code><\/pre>\n<p>With an argument of 0 (zero), the <strong>\u2013S<\/strong> option prevents the drive from entering low-power mode and spinning down. The numeric arguments cause the drive to spin down after a specified period of inactivity. An argument in the range of 1-240 causes the drive to spin down after nx5 seconds (120 causes the drive to spin down after 10 minutes of inactivity). An argument in the range 241-251 cause the drive to spin down after (n-240)x30 minutes. These values may vary between drive manufacturers.<\/p>\n<h3>Performance Testing<\/h3>\n<p>The <strong>\u2013T<\/strong> and <strong>\u2013t<\/strong> options yield benchmarks for the drive. The uppercase option displays cache read benchmarks while the lowercase option displays device read benchmarks.<\/p>\n<pre><code>mark@tea:~$ <strong>sudo hdparm -Tt \/dev\/sdf<\/strong>\r\n\/dev\/sdf:\r\n Timing cached reads:   15200 MB in  2.00 seconds = 7609.46 MB\/sec\r\n Timing buffered disk reads:  408 MB in  3.01 seconds = 135.52 MB\/sec\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The hdparm utility reports on and set device parameters. This blog explains a few of the hdparm options\u2014see the man page for more options and details. CAUTION: You can wreak havoc on a disk with some hdparm commands. You can &hellip; <a href=\"https:\/\/sobell.com\/mgsblog\/archives\/5\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,3],"tags":[],"_links":{"self":[{"href":"https:\/\/sobell.com\/mgsblog\/wp-json\/wp\/v2\/posts\/5"}],"collection":[{"href":"https:\/\/sobell.com\/mgsblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sobell.com\/mgsblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sobell.com\/mgsblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sobell.com\/mgsblog\/wp-json\/wp\/v2\/comments?post=5"}],"version-history":[{"count":78,"href":"https:\/\/sobell.com\/mgsblog\/wp-json\/wp\/v2\/posts\/5\/revisions"}],"predecessor-version":[{"id":7,"href":"https:\/\/sobell.com\/mgsblog\/wp-json\/wp\/v2\/posts\/5\/revisions\/7"}],"wp:attachment":[{"href":"https:\/\/sobell.com\/mgsblog\/wp-json\/wp\/v2\/media?parent=5"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sobell.com\/mgsblog\/wp-json\/wp\/v2\/categories?post=5"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sobell.com\/mgsblog\/wp-json\/wp\/v2\/tags?post=5"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}