{"id":41369,"date":"2023-08-03T09:43:06","date_gmt":"2023-08-03T01:43:06","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=41369"},"modified":"2023-08-03T09:43:06","modified_gmt":"2023-08-03T01:43:06","slug":"smartmontools-detect-harddisk","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/smartmontools-detect-harddisk.html","title":{"rendered":"\u4f7f\u7528 Smartmontools \u68c0\u6d4b\u786c\u76d8\u574f\u9053"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u574f\u9053\u662f\u4e00\u5757\u78c1\u76d8\u6216\u95ea\u5b58\u4e0a\u4e0d\u518d\u80fd\u591f\u88ab\u8bfb\u5199\u7684\u90e8\u5206\uff0c\u4e00\u822c\u662f\u7531\u4e8e\u78c1\u76d8\u8868\u9762\u7279\u5b9a\u7684\u7269\u7406\u635f\u574f\u6216\u95ea\u5b58\u6676\u4f53\u7ba1\u5931\u6548\u5bfc\u81f4\u7684\u3002\u968f\u7740\u574f\u9053\u7684\u7ee7\u7eed\u79ef\u7d2f\uff0c\u5b83\u4eec\u4f1a\u5bf9\u4f60\u7684\u78c1\u76d8\u6216\u95ea\u5b58\u5bb9\u91cf\u4ea7\u751f\u4ee4\u4eba\u4e0d\u5feb\u6216\u7834\u574f\u6027\u7684\u5f71\u54cd\uff0c\u751a\u81f3\u53ef\u80fd\u4f1a\u5bfc\u81f4\u786c\u4ef6\u5931\u6548\u3002\u574f\u5757\u7684\u5b58\u5728\u8b66\u793a\u4f60\u5e94\u8be5\u5f00\u59cb\u8003\u8651\u4e70\u5757\u65b0\u78c1\u76d8\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"fdisk0\"<\/p>\n

\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u901a\u8fc7\u51e0\u4e2a\u5fc5\u8981\u7684\u6b65\u9aa4\uff0c\u4f7f\u7528\u7279\u5b9a\u7684\u78c1\u76d8\u626b\u63cf\u5de5\u5177\u8ba9\u4f60\u80fd\u591f\u5224\u65ad Linux \u78c1\u76d8\u6216\u95ea\u5b58\u662f\u5426\u5b58\u5728\u574f\u9053\u3002<\/p>\n

\u5728Linux\u4e0a\u4f7f\u7528\u574f\u5757\u5de5\u5177\u68c0\u67e5\u574f\u9053<\/strong><\/div>\n

\u574f\u5757\u5de5\u5177\u53ef\u4ee5\u8ba9\u7528\u6237\u626b\u63cf\u8bbe\u5907\u68c0\u67e5\u574f\u9053\u6216\u574f\u5757\uff0c\u8bbe\u5907\u53ef\u4ee5\u662f\u4e00\u4e2a\u78c1\u76d8\u6216\u5916\u7f6e\u78c1\u76d8\uff0c\u7531\u4e00\u4e2a\u5982 \/dev\/sdc \u8fd9\u6837\u7684\u6587\u4ef6\u4ee3\u8868\u3002\u9996\u5148\uff0c\u901a\u8fc7\u8d85\u7ea7\u7528\u6237\u6743\u9650\u6267\u884c fdisk \u547d\u4ee4\u6765\u663e\u793a\u4f60\u7684\u6240\u6709\u78c1\u76d8\u6216\u95ea\u5b58\u7684\u4fe1\u606f\u4ee5\u53ca\u5b83\u4eec\u7684\u5206\u533a\u4fe1\u606f\uff1a<\/p>\n

sudo fdisk -l<\/pre>\n

\"fdisk1\"<\/p>\n

\u7136\u540e\u7528\u5982\u4e0b\u547d\u4ee4\u68c0\u67e5\u4f60\u7684 Linux \u786c\u76d8\u4e0a\u7684\u574f\u9053\/\u574f\u5757\uff1a
\n\"fdisk2\"<\/p>\n

\u4e0a\u9762\u7684\u547d\u4ee4\u4e2d\uff0cbadblocks \u626b\u63cf\u8bbe\u5907 \/dev\/sda10\uff08\u8bb0\u5f97\u6307\u5b9a\u4f60\u7684\u5b9e\u9645\u8bbe\u5907\uff09\uff0c-v \u9009\u9879\u8ba9\u5b83\u663e\u793a\u64cd\u4f5c\u7684\u8be6\u60c5\u3002\u53e6\u5916\uff0c\u8fd9\u91cc\u4f7f\u7528\u4e86\u8f93\u51fa\u91cd\u5b9a\u5411\u5c06\u64cd\u4f5c\u7ed3\u679c\u91cd\u5b9a\u5411\u5230\u4e86\u6587\u4ef6 badsectors.txt\u3002<\/p>\n

\u5982\u679c\u4f60\u5728\u4f60\u7684\u78c1\u76d8\u4e0a\u53d1\u73b0\u4efb\u4f55\u574f\u9053\uff0c\u5378\u8f7d\u78c1\u76d8\u5e76\u50cf\u4e0b\u9762\u8fd9\u6837\u8ba9\u7cfb\u7edf\u4e0d\u8981\u5c06\u6570\u636e\u5199\u5165\u56de\u62a5\u7684\u6247\u533a\u4e2d\u3002<\/p>\n

\u4f60\u9700\u8981\u6267\u884c e2fsck\uff08\u9488\u5bf9 ext2\/ext3\/ext4 \u6587\u4ef6\u7cfb\u7edf\uff09\u6216 fsck \u547d\u4ee4\uff0c\u547d\u4ee4\u4e2d\u8fd8\u9700\u8981\u7528\u5230 badsectors.txt\u6587\u4ef6\u548c\u8bbe\u5907\u6587\u4ef6\u3002<\/p>\n

-l \u9009\u9879\u544a\u8bc9\u547d\u4ee4\u5c06\u5728\u6307\u5b9a\u7684\u6587\u4ef6 badsectors.txt \u4e2d\u5217\u51fa\u7684\u6247\u533a\u53f7\u7801\u52a0\u5165\u574f\u5757\u5217\u8868\u3002<\/p>\n

------------ \u9488\u5bf9 for ext2\/ext3\/ext4 \u6587\u4ef6\u7cfb\u7edf ------------\r\n$ sudo e2fsck -l badsectors.txt \/dev\/sda10\r\n \r\n\u6216\r\n \r\n------------ \u9488\u5bf9\u5176\u5b83\u6587\u4ef6\u7cfb\u7edf ------------\r\n$ sudo fsck -l badsectors.txt \/dev\/sda10<\/pre>\n
\u5728 Linux \u4e0a\u4f7f\u7528 Smartmontools \u5de5\u5177\u626b\u63cf\u574f\u9053<\/strong><\/div>\n

\u8fd9\u4e2a\u65b9\u6cd5\u5bf9\u5e26\u6709 S.M.A.R.T\u7cfb\u7edf\u7684\u73b0\u4ee3\u78c1\u76d8\uff08ATA\/SATA \u548c SCSI\/SAS \u786c\u76d8\u4ee5\u53ca\u56fa\u6001\u786c\u76d8\uff09\u66f4\u52a0\u7684\u53ef\u9760\u548c\u9ad8\u6548\u3002S.M.A.R.T \u7cfb\u7edf\u80fd\u591f\u5e2e\u52a9\u68c0\u6d4b\uff0c\u62a5\u544a\uff0c\u4ee5\u53ca\u53ef\u80fd\u8bb0\u5f55\u5b83\u4eec\u7684\u5065\u5eb7\u72b6\u51b5\uff0c\u8fd9\u6837\u4f60\u5c31\u53ef\u4ee5\u627e\u51fa\u4efb\u4f55\u53ef\u80fd\u51fa\u73b0\u7684\u786c\u4ef6\u5931\u6548\u3002<\/p>\n

\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5 smartmontools\uff1a<\/p>\n

------------ \u5728\u57fa\u4e8e Debian\/Ubuntu \u7684\u7cfb\u7edf\u4e0a ------------\r\n$ sudo apt-get install smartmontools\r\n \r\n------------ \u5728\u57fa\u4e8e RHEL\/CentOS \u7684\u7cfb\u7edf\u4e0a ------------\r\n$ sudo yum install smartmontools<\/pre>\n

\u5b89\u88c5\u5b8c\u6210\u4e4b\u540e\uff0c\u4f7f\u7528 smartctl \u63a7\u5236\u78c1\u76d8\u96c6\u6210\u7684 S.M.A.R.T \u7cfb\u7edf\u3002\u4f60\u53ef\u4ee5\u8fd9\u6837\u67e5\u770b\u5b83\u7684\u624b\u518c\u6216\u5e2e\u52a9\uff1a<\/p>\n

$ man smartctl\r\n$ smartctl -h<\/pre>\n

\u7136\u540e\u6267\u884c smartctrl \u547d\u4ee4\u5e76\u5728\u547d\u4ee4\u4e2d\u6307\u5b9a\u4f60\u7684\u8bbe\u5907\u4f5c\u4e3a\u53c2\u6570\uff0c\u4ee5\u4e0b\u547d\u4ee4\u5305\u542b\u4e86\u53c2\u6570 -H \u6216 --health \u4ee5\u663e\u793a SMART \u6574\u4f53\u5065\u5eb7\u81ea\u6211\u8bc4\u4f30\u6d4b\u8bd5\u7ed3\u679c\u3002<\/p>\n

$ sudo smartctl -H \/dev\/sda10<\/pre>\n

\"fdisk4\"<\/p>\n

\u4e0a\u9762\u7684\u7ed3\u679c\u6307\u51fa\u4f60\u7684\u786c\u76d8\u5f88\u5065\u5eb7\uff0c\u8fd1\u671f\u5185\u4e0d\u5927\u53ef\u80fd\u53d1\u751f\u786c\u4ef6\u5931\u6548\u3002\u8981\u83b7\u53d6\u78c1\u76d8\u4fe1\u606f\u603b\u89c8\uff0c\u4f7f\u7528 -a \u6216 --all \u9009\u9879\u6765\u663e\u793a\u5173\u4e8e\u78c1\u76d8\u6240\u6709\u7684 SMART \u4fe1\u606f\uff0c-x \u6216 --xall \u6765\u663e\u793a\u6240\u6709\u5173\u4e8e\u78c1\u76d8\u7684 SMART \u4fe1\u606f\u4ee5\u53ca\u975e SMART \u4fe1\u606f\u3002<\/p>\n

\n

\u539f\u6587\u6765\u81ea\uff1ahttp:\/\/www.centoscn.com\/CentOS\/Intermediate\/2016\/1119\/8218.html<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttp:\/\/lrxjmw.cn\/smartmontools-detect-harddisk.html<\/a>\u7f16\u8f91\uff1a\u51af\u632f\u534e\uff0c\u5ba1\u6838\u5458\uff1a\u6768\u9e4f\u98de<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb \u574f\u9053\u662f\u4e00\u5757\u78c1\u76d8\u6216\u95ea\u5b58\u4e0a\u4e0d\u518d\u80fd\u591f\u88ab\u8bfb\u5199\u7684\u90e8\u5206\uff0c\u4e00\u822c\u662f\u7531\u4e8e\u78c1\u76d8\u8868\u9762\u7279\u5b9a\u7684\u7269\u7406\u635f\u574f\u6216\u95ea\u5b58\u6676\u4f53\u7ba1\u5931\u6548\u5bfc\u81f4\u7684\u3002\u968f\u7740 […]<\/p>\n","protected":false},"author":63,"featured_media":41378,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-41369","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/41369","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=41369"}],"version-history":[{"count":5,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/41369\/revisions"}],"predecessor-version":[{"id":279380,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/41369\/revisions\/279380"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/41378"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=41369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=41369"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=41369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}