Drive failure handling
This page describes how Klennet Recovery deals with devices that lock up or disconnect
during the filesystem scan or during the disk imaging process.
The problem
Some storage devices may be damaged in a way that causes the device to lock up after a particular address is accessed.
While rare with SATA hard drives, this failure mode is more common with USB-connected devices, like USB flash drives or SD cards.
So, the drive becomes inaccessible when Klennet Recovery makes an image and encounters the particular faulty block.
Typically, the drive requires a power cycle to recover.
SATA drives with bad blocks often exhibit this behavior when connected via a USB-to-SATA converter.
Often it is the converter that locks up, not the drive itself.
If the drive has a SATA connector, connect it to a SATA port.
Avoid USB-to-SATA converters like the plague (which they are).
Power is cycled either manually by unplugging a USB drive from the socket and plugging it back
or automatically by a software-controlled relay.
The example of the software controlled relay is YKUSH 3 from https://www.yepkit.com.
It is a USB3 hub with three ports, each of which can be turned on and off by running a program from the command line.
Handling locked-up devices
When Klennet Recovery detects that the drive it needs to read has locked up, it will
-
Execute the specified external program if configured.
This program should command whatever hardware relay you use to power-cycle the drive.
-
If there is no external reset program configured, or if it fails to clear the problem,
Klennet Recovery will display the window prompting you to clear the problem manually,
and then it will try to reopen the drive.
You should unplug and replug the drive if it uses USB power, or power cycle it if it uses an external power supply.
When done, click Retry.
Configuring the external program
In the Settings tab, Drive failure handling section,
you can specify a program to execute and the timeout.
Klennet Recovery will execute the program without any parameters.
If your hardware requires multiple commands, you can place everything into a single .BAT file
and point Klennet Recovery to this .BAT file.
If the program fails to complete its execution and exit within the specified timeout period,
Klennet Recovery will attempt to close it and continue.
Please note that you may want to put your command into a .BAT file and add a timeout command
(for example, TIMEOUT 5 for a five-second delay)
to allow some time for Windows to detect the drive and initialize the appropriate device drivers.
You may need larger timeouts for a regular hard drive, which needs time to spin up.
The example BAT file for YKUSH 3 relay looks like this:
ykushcmd ykush3 -d 1
timeout 2
ykushcmd ykush3 -u 1
timeout 5
The logic is as follows:
- Turn off the first USB port. This disconnects both data and power lines of the port.
- Wait two seconds for everything to respond.
- Turn the first USB port back on.
- Wait five seconds for the device to initialize (assuming SSD or SD-card reader; a 2.5 inch spinning drive will need ten seconds or so).
The specific settings are as follows:
Execute a program on drive failure
This setting works as a master switch for the entire section.
If it is disabled, Klennet Recovery does not attempt to call the external program when it detects a failed drive.
Program to execute
Specify the path to the program you want to run to attempt a drive reset.
You can point to an executable file (EXE) or a DOS batch file (BAT).
Limit wait time
This parameter specifies how long to wait for the external program to complete its execution.
After the timeout expires, the external program is terminated, possibly leaving the device in an inconsistent state.
- If you are using a BAT file, ensure the timeout specified here is longer than the sum of all timeouts in the BAT file.
- If you are using Debug mode (see below), use "Wait indefinitely".
- Conversely, if you use Run hidden for an execution mode, avoid an indefinite timeout.
If something is wrong with the external program while running hidden, everything will lock up with no way for you to see the problem.
Execution mode
This switch controls how the external program is run. Three options are available:
- Run visible.
The program will run with a visible window, so it will pop up on the screen and close every time the drive is reset.
Some people find it annoying, but it gives you feedback on what's happening.
- Run hidden. The program will run invisible, without displaying any window.
- Debug mode.
The program will run visible, and the console window will not close at the end of the run.
This mode allows you to examine the output and see if something is not working correctly.
When done looking at the output, type EXIT to close the console.
Use debug mode combined with the indefinite timeout, so you have time to examine the output.
If the timeout is set, Klennet Recovery will force the console to close after the timeout expires.
What happens after the reset
After the drive is recovered after the reset, Klennet Recovery will skip the block that caused the problem and continue.
- If imaging, the bad block is enqueued for the next phase. If already in the final phase, the block is declared bad.
- If scanning filesystem, the block is declared bad and the scan continues. Some data is thus lost.
- If scanning a multi-disk filesystem volume or RAID with enough redundancy, the block is reconstructed from parity or mirror data.
See also