Skip to content

Repair unreadable sectors

A sector a drive cannot read is pending (SMART attribute 197). The drive waits for it to be written, then finds it fine again or replaces it with a spare. Its contents are lost either way. repair gets that done, and writes only to sectors that cannot be read.

Terminal window
sudo smartdisk repair disk4
sudo smartdisk repair disk4 -range 1048576:2097152 # only this area, in bytes (repeatable)
  1. Checks first: the disk must not hold the running system, and the repair must be confirmed by typing the disk ID (or -confirm <disk> in scripts).
  2. Unmounts the disk’s volumes, so nothing else writes meanwhile, and mounts them again at the end.
  3. Reads the disk (or only the -range areas) in 1 MiB steps. A failed read is checked again in 4 KiB units. A unit that reads on one of three further tries is left alone and reported as weak.
  4. Writes only a unit that keeps failing: its unreadable 512-byte sectors as zeros, its readable ones with their own contents. Then it reads it back.
  5. Shows the drive’s pending and reallocated counts before and after.

Readable data is never changed. A file that lay on a rewritten sector has zeros there; it was damaged already. More than 1,000 such places stop the repair: such a disk needs a rescue copy, not repairs.

In SmartDisk for Mac, a read test with read errors offers Repair… for exactly those areas; Read test → Repair unreadable sectors… checks the whole disk.