A step-by-step example of how to use this
function can be found here.
DiskPatch allows you to scan a selected partition, an entire disk or a user
defined area of the disk for what is
commonly referred to as 'bad sectors'. Bad sectors can be the cause for many
types of data loss: files may become corrupt because some of the sectors that the
file was saved to have become unreadable, or whole partitions may become in-accessible because the structures that define the partitions contain
Sometimes disk problems can be fixed by
the tools that are included with several operating systems: scandisk, checkdisk
or similar tools will sometimes restore access to files if disk structures such
as the FAT were damaged. These tools however do not correctly address the
problems that might arise from bad sectors. Let's look at this a bit more
The first priority for a tool such as scandisk or checkdisk is a consistent file
system. In other words, their main job is to keep the file system okay, not
the actual data that resides on the disk. If a problem occurs with the
file system, scandisk or checkdisk may repair the damage, but always in favor of
the file system. The result may be that access to actual data can be compromised
because the repair could only be completed by removing references to certain
files from the file system. These removed files (or fragments of them) then
appear as filexxxx.chk files (in case of scandisk or checkdisk).
Another point of interest is how tools like scandisk and checkdisk handle read
problems. To put it simple: they don't do that very well. If they encounter a
read problem (a bad sector) the entire cluster that the bad sector was a part
of, is discarded. If a disk has large clusters (32K clusters for FAT32 is
normal, that's 64 sectors per cluster) you lose capacity, not to
mention the impact this may have on files or file system structures. Also, since
scandisk and checkdisk by default only check the used areas of the disk, bad
sectors may not announce themselves until data is written to one. That may be
|How modern day hard disks handle
These days disks have a so called 'spare pool' of sectors. When a sector
on a disk becomes unreadable and should be taken out of commission, the
disk maps one of the sectors from the spare pool to the location that
contains the unreadable sector. The problem sector is not 'replaced' as
such, but simply ignored from now on: the sector from the spare pool is
used when the disk accesses the original bad sector. This process is
called 'remapping', or 'sector reallocation'.
It is possible to enforce this remapping process: when a sector becomes
inaccessible, it is usually only remapped when the 'bad sector' is
accessed for a write operation after it has been detected as being a
'bad sector'. By writing to a sector on the disk the remapping is
triggered IF the sector was marked for remapping. This effectively 'fixes' an unreadable sector, as long as the
spare pool is not yet depleted.
It's important to understand that when we speak of 'repairing bad
sectors', the remapping as described above is what we're talking about.
DiskPatch surface scanning
DiskPatch will scan each sector on the disk, whether it's a part of a
FAT, filled with data or empty. By allowing DiskPatch to detect 'bad
sectors' before the Operating System or the on-board disk repair tools do, you allow your
internal error management to take care of the bad sector: it will be
The surface scan is a smart scan: the scan starts by reading sectors along the
disk. Once a read error comes up the bad sector will be re-read and written to
as needed, to try to read the data and 'repair' the bad sector. The sector will
be verified and then the scan will continue.
By default DiskPatch will stop the scan after the first read error was found.
This way you are made aware of the state of the disk before actual repair
attempts are made. This behavior can be changed by changing this
setting in the settings screen before starting the surface scan.
DiskPatch interacts with sectors on a low level and does not interact with the
file system. When DiskPatch detects a read problem, it is handled (by
the disk) using
one of the following strategies:
Error on read that can be corrected:
Hard disks apply multiple strategies for correcting 'bad' data allowing the
disk to provide you with your data even if a sector could not be read
entirely. If the data in a sector can be recovered using this strategy, the
data is copied to a spare sector and the bad sector is taken out of service.
- Error on read that could not be corrected:
If a sector can not be read and the hard disk's automatic error correction can not recover
the data in the sector, the sector will become a candidate for reallocation.
A read error will be reported. The candidate for reallocation will be
reallocated when the sector is accessed for a write operation.
- Error on write:
The bad sector is taken out of service and the data is immediately written
to a spare sector. In other words, the bad sector is 'reallocated'.
If sectors were corrected they will not appear
again during the next disk surface scan; this means that if errors that appeared
in the first surface scan do not appear in the next surface scan, these 'bad
sectors' were reallocated and should now be available again for use.
Using DiskPatch to find and correct disk errors
There are a number of configuration settings
that affect DiskPatch's behavior during surface scanning. Make sure these
settings are correct before starting the scan.
The settings that affect surface scanning are:
- read retries
- write retries
- read error threshold
- write error threshold
- interrupt scan on first read error
- disk reset after error
- write sector after read error
- verify fixed bad sectors
If a read error is
encountered and the data can be read from the sector, the data will be
placed in a spare sector and the problem is solved.
If a sector can not be read on the first attempt, DiskPatch will retry the
read action as many times as is configured in the 'Read
Retries' setting. If the read eventually succeeds, the correct sector
handling strategy is applied.
If the data can not be read, a read error is reported and the sector becomes a candidate for
data in the sector is lost and the candidate sector will be
reallocated during the next write operation. What happens next depends on
the configuration settings. By default DiskPatch will attempt to write to the
sector to enforce the reallocation (the 'write sector after read error'
setting). That will be followed by another read attempt to verify that the
sector has indeed been reallocated (the 'verify fixed bad sector' setting). If
that last action fails the sector is reported as bad by DiskPatch, and will
still be considered bad by the disk.
You can use our
S.M.A.R.T. utility or the disk's manufacturer diagnostic tool
(refer to the disk manufacturer website) to determine the exact condition
of the hard disk. Once the pool of spare sectors has been exhausted bad sectors
can no longer be reallocated, and bad sectors will continue to appear during
Settings that affect a surface scan:
- interrupt scan on first read error:
on by default. When a read error is encountered DiskPatch will halt the
surface scan and display the settings screen. Adjust the settings as needed
and continue the scan by exiting the settings screen (press <esc>). By
doing this the user is made aware of the state of the disk. If you wish to
let the scan run uninterrupted, adjust this setting in the settings screen
before starting the surface scan.
- disk reset after error:
when enabled DiskPatch will send a
disk reset command to the hard disk after encountering a read- or write
error. This may have a positive effect on further read or write actions, but
might also slow down the read- or write operation considerably.
To run a surface scan:
Select [Disk related tasks], [Surface Scan], then select a partition to scan or select a region of the disk manually:
To scan the
entire disk, select 'entire disk' and leave the suggested default values
(just press <enter>).
When you press <esc> during the
scan, DiskPatch will display the settings screen:
You can adjust settings that affect the
surface scan, or abort the operation by selecting the 'Abort' option. Press
<esc> again to exit the settings screen and continue with the new
|What happens when a bad sector
If DiskPatch encounters a bad sector during a read operation and the
sector's contents can not be read at all, DiskPatch replaces the sector
data with a text string: DPBADSECTOR. If the contents of the (bad)
sector are written to disk after the read error, the sector data
will contain this string. This can help to locate files that were
affected by the read errors: search through the files and use
DPBADSECTOR as a search string.