dd if=/dev/sda1 of=/opt/cpc/sda1.dat sha1sum /opt/cpc/sda1.dat > /opt/cpc/sda1.dat.sha
hexdump -C sda1.dat | grep -i "exif" >headers.hex cat headers.hex | awk '{print (sprintf("%d","0x"$1)/512)}' > headers.512.dec cat headers.512.dec | xargs --replace bash -c "dd skip={} if=sda1.dat bs=512 count=4000 of=./{}.jpg"Unfortunately, we sometimes delete images and some data was fragmented, so we only recovered half of the images that way.
Images - sda1.dat Files (471) - Allocated (260) - Unallocated (211) Files Skipped (425) - Non-Files (425) - 'ignore' category (0) Extensions - Extension Mismatches (0) Categories (42) - images (41) - unknown (1)Then I decided to do some home magic to take care of the non-files:
#!/usr/bin/perl # recover.pl - 2005/09/27 - Nicolas LidzborskiHere we go, I got 206 files out of this, recovering all the pictures of our trip! :)- GPL2 open FLS,'fls sda1.dat -f fat -r|' or die "Cannot use fls: $!"; while( ){ if (m|r/r \* (\d+):\s+(\S+JPG)$|){ my ($inode,$filename)=($1,$2); print "icat -t fat sda1.dat $inode > data/$filename\n"; `icat -f fat sda1.dat $inode > data/$filename`; } } close FLS;
Nicolas Lidzborski (cpc at freeshell.org) on June 9th 2003, edited on August 22nd 2003