Skip to content

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 ​

bash
sudo diskrescue-tui

It 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 ​

bash
sudo diskrescue image /dev/sdb card.img
diskrescue recover card.img -o ~/Recovered

The 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:

bash
sudo diskrescue recover /dev/sdb --image-to card.img -o ~/Recovered

Without --image-to, the drive is read directly. That is fine for a healthy drive, not for a failing one.

Repair files ​

bash
diskrescue repair broken.mp4 -o fixed --donor good_clip_same_phone.mp4
diskrescue repair IMG_0042.JPG IMG_0043.JPG -o fixed

Inputs are never modified. Repaired copies go to fixed/repaired/.

Common situations ​

SituationCommands
Card says "card error" or asks to be formatteddiskrescue image, then diskrescue recover on the image. Do not format
Photos deleted by accident from a healthy drivesudo diskrescue recover /dev/sdX -o out, then look in out/deleted/ and out/carved/
Video will not playdiskrescue repair with --donor
See what could be recovered, writing nothingdiskrescue scan SOURCE

All commands and options are in the Reference.

Next steps ​