From 52f86ea0075c66e18e4796ad88f45541da8b4de5 Mon Sep 17 00:00:00 2001 From: Miguel Date: Thu, 7 Mar 2019 23:26:17 +0100 Subject: some cleanup and such --- 080_blog/00015_Admin/00030_Fixing-HDD/index.md | 48 ++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 080_blog/00015_Admin/00030_Fixing-HDD/index.md (limited to '080_blog/00015_Admin/00030_Fixing-HDD') diff --git a/080_blog/00015_Admin/00030_Fixing-HDD/index.md b/080_blog/00015_Admin/00030_Fixing-HDD/index.md new file mode 100644 index 0000000..0bae730 --- /dev/null +++ b/080_blog/00015_Admin/00030_Fixing-HDD/index.md @@ -0,0 +1,48 @@ +# Fixing HDD after Free Falling + +So you also dropped your hard-disk and some of your secotrs got damaged, +probably by the head hitting the platter? + +Backup all your data. + +## smartctl + +Try from fastest to slowest to find faulty sector: replace LBAi\_START,LBA\_END with meaningful values. + + smartctl -t [long|conveyence|short|select,LBA_START-LBA_END] -C /dev/sda + +## hdparm + +Bi-search via –read-sector if complete ranges are affected (as in my case) and then fix them in one step: + + for i in {36312851..36312886}; do hdparm --write-sector $i /dev/sda; done + +## Example + +Exemplary session fixing one sector: + +**WARNING: this will destroy your data !** + + 1) # smartctl -a /dev/sda | egrep 'Pend|Real|Offline_Unc' + + 5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always - 4 + 197 Current_Pending_Sector 0x0012 098 098 000 Old_age Always - 47 + 198 Offline_Uncorrectable 0x0010 098 098 000 Old_age Offline - 47 + + 2) # smartctl -t short /dev/sda + + 3) # smartctl -l selftest /dev/sda + + [...] 1 Short offline Completed: read failure 90% 10632 152076520 + + 4) # hdparm --read-sector 152076520 /dev/sda # verification + + [...] reading sector 152076520: FAILED: Input/output error + + 5) # hdparm --write-sector 152076520 /dev/sda + + 6) # smartctl -a /dev/sda | egrep 'Pend|Real|Offline_Unc' + + 5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always - 4 + 197 Current_Pending_Sector 0x0012 098 098 000 Old_age Always - 46 + 198 Offline_Uncorrectable 0x0010 098 098 000 Old_age Offline - 46 -- cgit v1.2.3