A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects. (Robert A. Heinlein)

Home » Post Item » Recovering accidentally deleted photos using Linux

Recovering accidentally deleted photos using Linux

Saturday, December 12th, 2009

I suppose it happened almost everybody to have some digital photo accidentally deleted from a memory card. It happened to me some days ago, after a power failure, I discovered the photos I was moving from the camera already had disappeared from the memory card but never had been saved on the hard disk.

 

The undelete process

 

The memory card, fortunately, did no suffer any damage during the power failure. Following instructions on this Ubuntu community documentation page I installed foremost:

sudo apt-get install foremost

then I executed it

sudo foremost -i /dev/sdc1 -o /recovery/foremost

/dev/sdc1” is the card reader device .

The program extracted all previously deleted in the output directory all neatly separated, by file type, in different folders.

More the 15 000 photos?

 

Since I was only looking for photos I changed the folder “jpg” owner

sudo chown -R maxx:maxx output/

and started exploring it. When you recover deleted files you already expect finding files you don’t remember of but I was really stunned when I found that more than 15000 jpeg photos had been recovered! Examining recovered photos I discovered that most of them where small 640×480 photos this leaded me to think that such pictures are created and automatically deleted by the camera while recording movies. Still I had the problem to sort out the pictures I was looking for without having to peek at 15000 thumbnails. Sorting them by size would obviously be the best solution but even the good Gnome file manager seems to have some problem with such numbers …

 

Good old find command

 

The best thing of Linux is that where the graphical environment fails the shell don’t. After looking a little in the ‘net (especially here and there) and reading a little find command man pages I managed to sort out pictures larger than 1MB and move then in another folder with a single command

find . -type f -size +1024k -exec mv {} /home/maxx/recovery/ \;

 

Links

 

Posted by musante at 20:17:00 | permalink

Previous Comments

Hey Maxx, thanks for sharing this great piece with us. Really appreciated.

Posted by ghabuntu at December 13, 2009, 9:08 pm

My last comment was not completed I guess. I really appreciate this post cuz a similar thing happened to me and oh boy was I hot.

And I like your point where you infeered the GUI and CLI are complimentary. That’s exactly my point.

Posted by ghabuntu at December 13, 2009, 9:11 pm

NICE BLOG.

http://www.apcmysr.blogspot.com/

Posted by krishna reddy at December 19, 2009, 7:03 pm

nice info, thx

Posted by yusuf at January 15, 2010, 9:48 am

All comments are moderated. Your comments will not appear here unless approved by the blog owner. Thank you.

Add a comment