Page 1 of 1

HDD rewrite bad sectors

Posted: Tue Jan 16, 2024 2:09 pm
by zemerdon
I'd run a long selftest

Code: Select all

smartctl -t long /dev/ada2

check the smart information for the unreadable sector, lets call it 'X'

Code: Select all

smartctl -A /dev/ada2

change the syscontrol and try writing to the sector. Change the 'X' below

Code: Select all

sysctl kern.geom.debugflags=16
dd if=/dev/zero of=/dev/ada2 bs=4096 count=1 seek=X conv=noerror,sync

check the smart information to see if 'Current_Pending_Sector' went to 0, you may need to repeat some of the steps multiple times if there are multiple unreadable sectors..

Code: Select all

smartctl -A /dev/ada2

Now run another smart test and hopefully it can complete without error.

Code: Select all

smartctl -t long /dev/ada2
smartctl -A /dev/ada2 #check status to see if it completed

Now run a scrub (either from the gui or with 'zpool scrub poolname').
Check the scrub's status and hopefully it fixes some errors.

Code: Select all

zpool status -v poolname