2012/05/07

Recover Deleted Pictures from Hard Drive

I hope you and I never need this information again. Several years ago, I accidently deleted pictures from my hard drive. I used the program "magicrescue" to recover my photos. This is a linux program. I do not know if Windows has an equivalent. If you are not comfortable running commands from the Linux command line, then you will need be friends with a Linux geek or hire one.

1. after deleting files you need to unmount the drive immediately. This step is then most important or run the risk of writing new data on top of your deleted pictures. Once you write new data on top of the pictures the file will be corrupted.

1.1 since I deleted files on my home directory, I restarted the computer and installed ubuntu on a seperate hard drive (It could also be installed on a separate partition). This allows you to work on the drive without it being mounted. If the deleted data drive is mounted, there is a danger that a file will be written overwriting the drive.
2. boot into new OS with new home directory
2.1 install magicrescue
3.1. sudo mount -t ext4 /dev/sdb1 /media/a # mounts hard drive to store recovered data
4.1 magicrescue -M io -d /media/a/a -r ~/Documents/magicrescue/recipes /dev/sde6
4.2 sudo chown chad:chad * #change ownership of files from root to chad

5.1 this worked, file names are not intact, but picture metadata is.

6.1 used jhead to rename files based upon date in exif data
6.2 http://www.sentex.net/~mwandel/jhead/usage.html
6.3.1 jhead -n%Y%m%d-%H%M%S *.jpg
6.3.2 This will rename files matched by *.jpg according to YYYYMMDD-HHMMSS

7.1.0 http://www.cgsecurity.org/wiki/PhotoRec_Step_By_Step
7.1.1 run photorec to recover .tiff and other file types. Should run photorec first probably
7.2 photorec [/log] [/debug] [/d recup_dir] [device|image.dd|image.e01]
7.3 $ sudo photorec #asks questions about what to recover, run this command from the directory you want to save files to
7.4 sudo chown chad:chad * #change ownership of files from root to chad

Help, Information, and Links


To view help, type from command line > man magicrescue

This site was helpful http://www.linux.com/archive/feature/126525

The basic command is: magicrescue -d directory -r recipe  device
example: magicrescue -d /mnt/external -r /usr/share/magicrescue/recipes/zip /dev/sda1.

recipes are located at: /usr/share/magicrescue/recipes
I copied recipes to use to ~/Documents/magicrescue/recipes

Good Luck and this was not spell checked

2 comments:

  1. HI Chad,

    Thanks for the information !

    See, I am a beginner with the linux systems as I upgraded to from windows 8 to ubuntu 14.04LTS version in the last october. I just wonder if the "magicrescue" will help me to recover my deleted photos from my pc.

    Can you please give me advice on how to get those items back in a step by step instruction. I am intrested in the command line and I am still trying hard to learn it. I have two partitions in my system and the photos were saved in one partition alone.

    Any help will be greatly appreciated.

    Thanks

    Afsal
    Afsal@fastmail.com

    ReplyDelete
  2. HI Chad,

    Thanks for the information !

    See, I am a beginner with the linux systems as I upgraded to from windows 8 to ubuntu 14.04LTS version in the last october. I just wonder if the "magicrescue" will help me to recover my deleted photos from my pc.

    Can you please give me advice on how to get those items back in a step by step instruction. I am intrested in the command line and I am still trying hard to learn it. I have two partitions in my system and the photos were saved in one partition alone.

    Any help will be greatly appreciated.

    Thanks

    Afsal
    Afsal@fastmail.com

    ReplyDelete