Command line and terminal app
The same engine runs without a desktop: diskrescue-tui is an interactive terminal app, and diskrescue is a command for scripts and experts.
Reading a raw drive needs administrator rights. On Linux, start the commands with sudo. On Windows, use a terminal opened as administrator.
Terminal app
sudo diskrescue-tuiIt follows the same flow as the desktop app. Arrow keys move, Enter chooses, ? shows the keys for the current screen and q quits. While a drive is being copied, p pauses and s stops and saves. Run the same rescue again to continue.
A typical rescue in two commands
sudo diskrescue image /dev/sdb card.img
diskrescue recover card.img -o ~/RecoveredThe first command copies the drive into card.img and keeps a progress map in card.img.map. Run it again to continue after a stop. The second finds the files in the image.
DANGER
Check the device name with diskrescue list before you type it. The image and the output folder must be on a different disk; DiskRescue refuses output on the source drive and exits with code 3.
To do both in one go:
sudo diskrescue recover /dev/sdb --image-to card.img -o ~/RecoveredWithout --image-to, the drive is read directly. That is fine for a healthy drive, not for a failing one.
Repair files
diskrescue repair broken.mp4 -o fixed --donor good_clip_same_phone.mp4
diskrescue repair IMG_0042.JPG IMG_0043.JPG -o fixedInputs are never modified. Repaired copies go to fixed/repaired/.
Common situations
| Situation | Commands |
|---|---|
| Card says "card error" or asks to be formatted | diskrescue image, then diskrescue recover on the image. Do not format |
| Photos deleted by accident from a healthy drive | sudo diskrescue recover /dev/sdX -o out, then look in out/deleted/ and out/carved/ |
| Video will not play | diskrescue repair with --donor |
| See what could be recovered, writing nothing | diskrescue scan SOURCE |
All commands and options are in the Reference.