meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| datarecovery:bad_sectors [2020/12/16 12:47] – niziak | datarecovery:bad_sectors [2020/12/16 13:19] (current) – niziak | ||
|---|---|---|---|
| Line 59: | Line 59: | ||
| Ready script to automate above: | Ready script to automate above: | ||
| [[https:// | [[https:// | ||
| + | Fixed version: | ||
| + | <code bash> | ||
| + | #!/bin/bash -u | ||
| + | baddrive=/ | ||
| + | badsect=974041815 | ||
| + | while true; do | ||
| + | echo Testing from LBA $badsect | ||
| + | smartctl -t select, | ||
| + | |||
| + | echo " | ||
| + | while [ " | ||
| + | echo -n . | ||
| + | sleep 5 | ||
| + | done | ||
| + | echo | ||
| + | |||
| + | echo " | ||
| + | while [ " | ||
| + | echo -n . | ||
| + | sleep 5 | ||
| + | done | ||
| + | echo | ||
| + | |||
| + | badsect=$(smartctl -l selftest ${baddrive} | awk '/# 1 Selective offline | ||
| + | [ $badsect = " | ||
| + | |||
| + | echo Attempting to fix sector $badsect on $baddrive | ||
| + | hdparm --repair-sector ${badsect} --yes-i-know-what-i-am-doing $baddrive | ||
| + | echo Continuning test | ||
| + | done | ||
| + | |||
| + | </ | ||
| + | |||
| For ZFS with RAIDZ filesytem, SCRUB is needed to replace bad data: | For ZFS with RAIDZ filesytem, SCRUB is needed to replace bad data: | ||