{"id":136,"date":"2017-01-27T12:37:48","date_gmt":"2017-01-27T12:37:48","guid":{"rendered":"http:\/\/owncloud.gonscak.sk\/?p=136"},"modified":"2017-01-27T12:37:48","modified_gmt":"2017-01-27T12:37:48","slug":"check-disks-for-bad-blocks-with-complete-erase-and-smart-self-test","status":"publish","type":"post","link":"https:\/\/www.gonscak.sk\/?p=136","title":{"rendered":"Check disks for bad blocks with complete erase and smart-self test"},"content":{"rendered":"<p>This is another useful script, which do a complete erase and test disk in linux.<br \/>\nThe first, we must have a tools &#8220;smartmontools&#8221;. We install it:<\/p>\n<pre>yum install smartmontools<\/pre>\n<p>Maybe, we nee som usefull software:<\/p>\n<pre><code>yum install epel-release.noarch\nyum install htop dstat lm_sensors.x86_64 hddtemp<\/code><\/pre>\n<pre>#!\/bin\/bash\n#path of disk\ntest = \/dev\/sda\n#find a serial number of disk\ndisk = `smartctl -a \/dev\/sda | grep Serial | awk '{print $3}'`\nlog = \/home\/vasil\/$disk.log\n#next, we destroy any of the partition table (mbr or gpt)\nsgdisk --zap-all $test &gt; $log\nsleep 5\n#notice a temperature of disk to log\nhddtemp $test &gt;&gt; $log\n#now we write zeros to every block of disk - secure erase contents\ndd if=\/dev\/zero of=$test bs=4M\n#notice a temperature of disk\nhddtemp $test &gt;&gt; $log\nsleep 5\n#begin an internal self test - short\nsmartctl --test=short $test\nsleep 150\n#begin a long smart self test\nhddtemp $test &gt;&gt; $log\nsmartctl --test=long $test\nsleep 300\nhddtemp $test &gt;&gt; $log\n#print the output of tests\nsmartctl -l selftest $test &gt;&gt; $log\nsleep 5\n#start check of disk for bad-blocks a log bad blocks to log\n`badblocks -v \/dev\/sda &gt; \/home\/vasil\/sda.txt` &gt;&gt; $log\nsleep 5\nhddtemp $test &gt;&gt; $log\nsmartctl --test=long $test\nexit 0<\/pre>\n<p>This is fully automatized. We can start this script with modification of variable $test for more disks. And next day, we can examine logs. For bad blocks, for smart self-test and other.<\/p>\n ","protected":false},"excerpt":{"rendered":"<p>This is another useful script, which do a complete erase and test disk in linux. The first, we must have a tools &#8220;smartmontools&#8221;. We install it: yum install smartmontools Maybe, we nee som usefull software: yum install epel-release.noarch yum install htop dstat lm_sensors.x86_64 hddtemp #!\/bin\/bash #path of disk test = \/dev\/sda #find a serial number &hellip; <a href=\"https:\/\/www.gonscak.sk\/?p=136\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Check disks for bad blocks with complete erase and smart-self test<\/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":[4],"tags":[15,12,16,13,8,17],"class_list":["post-136","post","type-post","status-publish","format-standard","hentry","category-centos","tag-badblocks","tag-check","tag-disk","tag-hddtemp","tag-linux","tag-smartctl"],"_links":{"self":[{"href":"https:\/\/www.gonscak.sk\/index.php?rest_route=\/wp\/v2\/posts\/136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gonscak.sk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gonscak.sk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gonscak.sk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gonscak.sk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=136"}],"version-history":[{"count":0,"href":"https:\/\/www.gonscak.sk\/index.php?rest_route=\/wp\/v2\/posts\/136\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.gonscak.sk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gonscak.sk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gonscak.sk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}