Scalpel: Extract lost files from disk/card image
Posted: Mon May 23, 2016 2:19 am
I'll post a collection of extraction examples using "scalpel" data forensics tool to "carve out" files from a broken filesystem, or simply deleted files.
Thanks again to Falko Timme's HowTo: "Recover Deleted Files With Scalpel".
And another nice source for info on data rescue (on GNU/Linux) is the "Data Recovery" article on Ubuntu's community wiki.
Let's proceed:
1) Extract exact image of original medium:
Very often, I have to deal with SD cards, because they are now commonly used as recording media on digital photo cameras, as well as audio recording devices.
I take a 1:1 image of the source medium, in order to work on a copy - and leave the original medium as untouched as possible.
In case of an SD-card, this is easily possible, because the image filesize is usually <= 64GB.
When dealing with harddisks, it's very uncommon that you have the necessary free space left on your local disk to make an image copy.
This is especially important, when there is indication that the SD-card may have gone bad. For example the partition (usually FAT/FAT32) cannot be mounted anymore, because it's corrupt.
This reads the physical SD card medium from /dev/sdX (replace the device string with the one of the card in your reader/slot) and writes it unmodified to a file $OUTPUT_FILE. Replace "$OUTPUT_FILE" with something, e.g. that describes what disk this image is from.
In order not to confuse rescued images later on, I use a naming like this:
Would result in the following output filename:
You should now have a 1:1 copy of your SD card source to work with. Read on...
Thanks again to Falko Timme's HowTo: "Recover Deleted Files With Scalpel".
And another nice source for info on data rescue (on GNU/Linux) is the "Data Recovery" article on Ubuntu's community wiki.
Let's proceed:
1) Extract exact image of original medium:
Very often, I have to deal with SD cards, because they are now commonly used as recording media on digital photo cameras, as well as audio recording devices.
I take a 1:1 image of the source medium, in order to work on a copy - and leave the original medium as untouched as possible.
In case of an SD-card, this is easily possible, because the image filesize is usually <= 64GB.
When dealing with harddisks, it's very uncommon that you have the necessary free space left on your local disk to make an image copy.
This is especially important, when there is indication that the SD-card may have gone bad. For example the partition (usually FAT/FAT32) cannot be mounted anymore, because it's corrupt.
Code: Select all
$ dd if=/dev/sdX of=$OUTPUT_FILE
In order not to confuse rescued images later on, I use a naming like this:
Example:sdcard-$DATE-$SIZE-$ORIGINATOR_$COMMENT.img
Code: Select all
$DATE = "20160520" (Date format: "YYYYMMDD" / This lists in chronoligical order when sorted alphabetically in the file explorer)
$SIZE = "08GB"
$ORIGINATOR = "mediathek"
$COMMENT = "deleted_recordings"
Code: Select all
sdcard-20160520-08GB-mediathek-deleted_recordings.img