Reconstructing files with Magic Rescue

Slashdot it! Delicious Share on Facebook Tweet! Digg!

To the Rescue!

Most distributions already have Magic Rescue in their repositories, which makes it easy as a rule to install this excellent utility over a graphical front end [2]. Once you have installed Magic Rescue, it's best to start by entering the magicrescue command without any further parameters to get an overview of the manageable number of options and their descriptions (Figure 2). Using multiple instances of the -r parameter, for example, you can reconstruct in a single run many different file formats.

Figure 2: Magic Rescue uses an uncomplicated syntax.

To start the scan and reconstruction, use the mkdir <folder> command to create a folder where you want the reconstructed files to go. Then, change to the recipe directory that Magic Rescue needs to access to recognize the file types and execute the following command:

$ magicrescue -r recipe_1 [...] -r recipe_n -d target_folder device

You indicate the device containing the data you want to rescue in the form of a partition on a block device, such as /dev/sdb1 or /dev/mmcblk0p1 with SD cards. If you enter a directory by mistake or just the device name, Magic Rescue will quit with an error message. (See the "Rescue Tip" for other info.)

Rescue Tip

If Magic Rescue confirms scanned files but returns a Command not found error message, some necessary third-party programs might be missing. This problem often comes up with JPEG files for which Magic Rescue uses the Jpegtran program to complete the reconstruction. This program can be found in most repositories in a package called jpeg-progs or libjpeg-progs .

After starting up, Magic Rescue scans the source partition and saves the scan pattern in the corresponding target directory (Figure 3). The scan results of the individual sectors can themselves be stored on quick-access Flash media, but this can take some time depending on the size of the disk. That's why Magic Rescue is less applicable for reconstructing files on large hard disks or SSD partitions.

Figure 3: Magic Rescue keeps you informed of the processing status.


If you use multiple instances of the -r parameter for various file types during reconstruction, Magic Rescue saves them all in the target directory. Because Magic Rescue might be reconstructing huge amounts of files, the dataset can quickly become unrecognizable.

With help from the Magicsort program [3] that comes with Magic Rescue, however, you can sort the files by type after a successful reconstruction. Use the magicsort <target_directory> command. Magicsort creates a separate subdirectory for each file type and sorts the files accordingly.

Buy this article as PDF

Express-Checkout as PDF

Pages: 2

Price $0.99
(incl. VAT)

Buy Ubuntu User

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content