上海品牌網(wǎng)站建設(shè)seo網(wǎng)站診斷流程
當(dāng)磁盤出現(xiàn)壞塊時(shí),你對所關(guān)聯(lián)的文件進(jìn)行讀取時(shí),一般會(huì)出現(xiàn) read error: Input/output error
這樣的錯(cuò)誤。
反過來講,當(dāng)你看到 read error: Input/output error
這種錯(cuò)誤時(shí),很大可能就是磁盤出現(xiàn)了壞塊問題。
解決步驟:
1、檢測磁盤
[root@k8s-dev-node1 ~]# badblocks -s -v /dev/sda
Checking blocks 0 to 83886079
Checking for bad blocks (read-only test): 35570264done, 1:37 elapsed. (0/0/0 errors)
35570265
35570266
35570267
35570268
35570269
35570270
35570271
done
Pass completed, 8 bad blocks found. (8/0/0 errors)
我這個(gè)磁盤就出現(xiàn)了8個(gè)壞塊,其中 /dev/sda
是你的磁盤設(shè)備名稱,可以使用 fdisk -l
查看。
如果需要把壞塊都寫入文件,可以添加參數(shù) -o
指定寫入的文件即可,例如 badblocks -s -v -o ./badblock.log /dev/sda
。
如果磁盤較大,可以考慮多個(gè)窗口多條命令并行檢測,這樣需要指定塊的范圍,如下所示:
# 語法 badblocks -s -v -o /root/badblock.log /dev/sda end start
# 示例(注意后面是先 end 后 start)
badblocks -s -v -o /root/badblock.log /dev/sda 400000000 1
badblocks -s -v -o /root/bad block.log /dev/sda 83886079 400000001
2、修復(fù)壞塊
如果找到了壞道,可以進(jìn)行寫入掃描進(jìn)行修復(fù)。
寫入掃描遇到壞道的時(shí)候會(huì)自動(dòng)重映射,寫入掃描會(huì)覆蓋原有數(shù)據(jù),所以請先備份。
寫入掃描速度很低,所以應(yīng)該只處理上面掃描時(shí)候發(fā)現(xiàn)錯(cuò)誤的部分,命令如下:
# 語法 badblocks -w -s /dev/sda END START
# 示例(注意后面是先 end 后 start)
badblocks -w -s /dev/sda 35570271 35570265
它可能會(huì)有操作不安全的提示 /dev/sda is apparently in use by the system; it's not safe to run badblocks!
這樣給命令添加一個(gè) -f
(force)參數(shù)再重復(fù)執(zhí)行即可。
最后處理完成后再重新檢測一遍。
參考資料:https://sites.google.com/site/itmyshare/storage/storage-disk/badblocks—search-a-device-for-bad-blocks
(END)