If you like me are struggling with old disks (in my case SCSI 10k RPM Ultra Wide 2 HP disks) that exhibits bad blocks, here is a short survival howto.
Those disks are placed in a refurbished HP Network RS/12 I use as a spool area for Bacula backups of our Apple XServe RAID which is used by Days of Wonder graphic Studio (and those guys knows how to produce huge files, trust me).
Since a couple of days, one of the disk exhibits read errors on some sectors (did I say they are old), so waiting to get replaced by other (old) disks, I had to find a way to have it working.
Of course the SCSI utility in the Adaptec SCSI card has a remapping tool, but you have to reboot the server and have it offline during the verify, which can take a long time, so that wasn’t an option.
I then learnt about sg3_utils (sg3-utils for the debian package) thanks to the very good page of smartmontools bad blocks handling.
This set of tools directly address SCSI disks through mode page, to instruct the disk to do some things. What’s interesting is that it comes with two commands of great use (there might be more of course):
- sg_verify: to check for the health of a sector
- sg_reassign: to remap a dead sector to one from the good sector list
Here is the use case:
1 2 3 4 5
Something is wrong, we only read 13MB instead of the whole disk. Let’s have look to the kernel log:
1 2 3 4 5 6
Indeed /dev/sda has a failed sector (at lba 3947441).
Let’s confirm it:
1 2 3 4 5 6
Check the defect list:
And tell the disk firmware to reassign the sector
Now verify that it was remapped:
Do we have a working sector?
1 2 3 4
The sector could be read! The disk is now safe.
Of course, this tutorial might not work for every disks: PATA and SATA disks don’t respond to SCSI commands.
For those disks, you have to write on the failed sector with dd and the disk firmware should automatically remap
the sector. This can be proved by looking at the Reallocated_Sector_Ct output of
Good luck :–)