Linux Mac Windows

Recover Accidentally Deleted Files From Any OS With PhotoRec [Windows, Mac, & Linux]

Tim Brookes 14-12-2012

recover deleted filesIn June I switched over from a combination of Windows and Linux to pretty much using OS X solely, and being largely familiar with Windows software (and painfully aware of the lack of many Linux alternatives) I had to replace a few oft-used programs with Mac-friendly alternatives. At some point I realised I was bereft of a file recovery tool and it was at that point I discovered PhotoRec.


Previously I’ve resorted to Recuva Restore Deleted Files Easily With Recuva Read More and written about Pandora Recovery Recover Lost Data For Free With Pandora Recovery [Windows] Last night I inadvertently deleted 17GB of data with a mis-press of Shift+Del, causing a classic "oh sh*t!!" moment. I’d chosen to "permanently delete" the folder, skipping the Recycle Bin and instantly freeing up some... Read More , neither of which play nicely with OS X. PhotoRec overcomes this by being compatible with just about every major OS including OS X, DOS and Windows 9x, modern Windows, Linux and even NAS drives How To Build & Use Your Own Network Attached Storage Using A Ubuntu Netbook Read More . The source code is also available for compiling on other systems, if you’re that way inclined.

PhotoRec & TestDisk

Despite the name, PhotoRec isn’t just a photo recovery tool – though it performs this function better than any other I have encountered. In reality PhotoRec is capable of recovering more than 390 file types including documents, archives, video files, executables and even disk images. If you’re after an exhaustive list of supported extension then check out the wiki which lists each any every one.

PhotoRec comes bundled with another, more advanced recovery tool called TestDisk. For now we’ll be focusing on PhotoRec which will suit most data recovery tasks. TestDisk is on another level of data recovery and capable of recovering whole partitions which is overkill when all you want to do is recover accidentally deleted digital camera snaps.

I’ve used PhotoRec a few times in the past, mostly to test what it’s capable of. Only this morning did I truly need it, after realising I had deleted hundreds of photographs that were stored on a USB stick (and nowhere else Sync Folders With Your USB Drive Using Allway Sync [Windows] Read More ). This is a foolish error I’d urge you not to make, but if you have to then at least make sure you have a tool like PhotoRec to hand. For those of you looking for “proof” of the software’s effectiveness then I’ll give you a little insight into my recovery options.

recover deleted files


In a recent article I ran over the process of installing Amahi home server using Ubuntu 12.04 LTS. I had to “burn” an .ISO to USB How To Install Linux With Ease Using UNetbootin We've already talked about Linux and why you should try it, but probably the hardest part of getting used to Linux is getting it in the first place. For Windows users, the simplest way is... Read More in order to install Ubuntu, though one thing I didn’t mention in the article is the fact that I accidentally downloaded Ubuntu 12.10 first. It was only during the install procedure did I notice I had the wrong version, so I then had to download 12.04 LTS, “burn” it again and carry on. A few hours later I realised my mistake of not checking the USB drive for precious data first.

I resigned myself to the fact that recovery was highly unlikely. It was only out of curiosity I thought I’d give PhotoRec a go.

Recovering With PhotoRec

The software uses the console, so there’s no flashy GUI to click or prod at. For the purpose of this article I’ll be using OS X, but the process is virtually identical on other operating systems.

how to recover deleted files


First download PhotoRec and extract it to anywhere except the drive you want to recover deleted files from. Don’t forget, the more data you write to a volume you’d like to recover from, the more data you are potentially destroying. Execute PhotoRec and you should see a window appear in your default console app (Terminal for OS X and Ubuntu users, Command Prompt on Windows).

how to recover deleted files

PhotoRec requires root (admin) access to your PC, and OS X users will see the screen I’ve included above. At this prompt on a Mac system simply hit enter to restart, input your password and you’re good to go. On Windows, you will need to run PhotoRec from an administrator account and on Linux you will need to do this from the command line using the sudo command, e.g. “sudo testdisk-6.13/photorec-static” followed by your administrator password.

how to recover deleted files


Once you’ve got PhotoRec running it’s a case of simply following the on-screen commands. First choose the device you would like to recover deleted files from, in my case it was the 2GB drive listed in the screenshot above.

restore deleted files

Next you’re prompted to choose a partition, along with a few options along the bottom of the screen. The Options screen has preferences for keeping corrupted files and enabling additional controls, while File Opt allows you to omit certain file types from the recovery process.

restore deleted filesIf you’re simply out to see what you can recover, I’d recommend leaving everything as default and hitting Search. The next screen asks whether you’re using an EXT2/EXT3 file system, or something else. For NTFS, FAT, HFS+ and other drive types choose Other.


restore deleted filesNext up you’ll be prompted whether to scan the whole volume or just unallocated space. On large drives a whole partition scan will take a long time, though on USB drives and memory cards it’s probably worth waiting a couple of hours if it means regaining lost data.

Recover Accidentally Deleted Files From Any OS With PhotoRec [Windows, Mac, & Linux] photorec6

The final prompt asks where you would like to recover the data to. The only really important thing to remember here is not to recover to the volume you are recovering from! I made a folder on my desktop and let PhotoRec go to work. Hit C to start the process, then let PhotoRec do its thing.

Recover Accidentally Deleted Files From Any OS With PhotoRec [Windows, Mac, & Linux] photorec8

I was lucky this time, I managed to recover more than 600 photos, despite erasing and writing to the volume twice. PhotoRec is an invaluable free tool to have at your disposal, especially on Mac OS X where so many companies charge for file recovery software.

recover deleted filesHave you had any close calls with data loss? Have you used PhotoRec or TestDisk in the past? Share your “oops!” moments in the comments, below.

Related topics: Data Recovery, Restore Data.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Anonymous
    August 5, 2015 at 5:43 am

    Thanks articles. I used uFlysoft Photo Recovery, when my daughter deleted a photo files off her comptuer. I was able to restore everything she needed with file salvage, but it can be a chore.

  2. Anonymous
    July 28, 2015 at 7:00 am

    One of the best photos recovery tools I used is uFlysoft Photo Recovery. It's a must have program.

  3. Anonymous
    June 23, 2015 at 12:45 pm

    Photorec help me fish out my video files (my daughter's fan dubs) and many other types of files such as icons, wallpapers, images, texts, pdf files, zips, etc.
    However, the games and softwares are split so it does not work for these latter files (.exe, .msi, etc).

  4. Anonymous
    March 4, 2015 at 8:09 am

    Thank goodness for this app. Managed to recovered deleted photos from my SD card. But is there any way to get the full resolution photos? Mine was like, pressed. All in all, still thankful those are recovered.

  5. Merry Joseph
    January 9, 2015 at 11:21 pm

    When you accidentally delete files from your computer then this situation can be miserable situation for you thus in this situations you can make use of Remo Recover which can easily recover all the lost data or deleted data within minutes..

  6. Mark Williams
    March 11, 2013 at 6:56 am

    There are some other good recovery software that work very well for the Windows as well as Mac OS. Stellar photo recovery software is one of them. I used it to recover lost files from my hard drive due to virus attack. It worked very well and able to recover almost all of files. Demo version of the software will help you to see the preview of the lost photos.

  7. prasanth vikkath
    January 21, 2013 at 3:28 am

    Its a great I started using it and. Recuva is also great.

  8. David Hallengren
    December 27, 2012 at 4:52 pm

    I've done this a couple times, but the program was coming up with some copies of pictures that seemed like thumbnails. It was a real pain to sort out the real pictures from the thumbnails. It would be great if this supported recovering files only over certain sizes, eg, 1 mb and higher.

    • Tim Brookes
      December 27, 2012 at 11:30 pm

      But you could just sort by size afterwards and discard any image filetypes under a certain size? It's software designed to recover as much as possible and when you really need this sort of thing you probably won't care too much about spending 5 minutes tidying up results afterwards!

  9. Phil Botsky
    December 20, 2012 at 1:28 pm

    I have never lost any data. Maybe its time to backup :D
    Thanks for nice article.

  10. Grace joy Nicor
    December 20, 2012 at 4:36 am

    i love linux as an OS because its too friendly and i didnt find it hard to use it.

  11. Salman Johnson
    December 19, 2012 at 3:01 am

    recuva is the best

  12. Muhammad Rizwan
    December 18, 2012 at 11:40 pm

    nice source rocks

  13. Ramon Fletcher
    December 14, 2012 at 8:18 pm

    Recently I reformatted the hard drive, used it as a pvr to record 4hrs of tv, reformatted it again then reinstalled bodhi linux. I then realised one word document that I had been working on for months. I installed testdisk with photorec and had recovered the file in a matter of an hour.

    Its a great app and another example of open source excellence

  14. Mac Witty
    December 14, 2012 at 7:39 pm

    I bought Disk Drill after your review and not being lucky in the giveaway in November. Happily not have had any real use of it (yet) but have tried it on deleted files and it seems to work very well

  15. Adriel Tan
    December 14, 2012 at 3:04 pm

    My friend deleted his entire POP work email inbox by accident..... PhotoRec saved ALL of it. Amazing.

  16. Raman Bathina
    December 14, 2012 at 10:43 am

    actually this software recover files but most of them are split into two or more parts.I mean if i recover mp3 songs then they are recover and available in 2 or 3 parts.

  17. Prashanth Rathore
    December 14, 2012 at 10:12 am

    MR.Tim brookes thanks for the info about this software this is really cool s/w........!!

  18. Alexander
    December 14, 2012 at 7:51 am

    I have fortunately not been in need for this kind of software. But thanks for article !

  19. Mitesh Budhabhatti
    December 14, 2012 at 7:06 am

    good article.. is there any option or any other tool which can recover the filename also??

    • Tim Brookes
      December 14, 2012 at 7:24 am


      This is from the PhotoRec FAQ at the CGSecurity wiki:

      "In some case, the filename is stored in the file itself, PhotoRec try to recover the filename in this case but most of the time, PhotoRec can't. PhotoRec uses the logical sector number to create the filename, it appends the original filename or the document title when possible, the filename ends by the file extension."

      Read more:

      There's also some information here about sorting the files after using the tool:

      Hope this helps, sorry I can't be more specific! In my case file names weren't important because it was just a USB stick full of pictures, but if it was a whole hard drive or mixed media I can see why you might want to do that.

      Good luck!

      • Mitesh Budhabhatti
        December 15, 2012 at 6:11 am

        Thanks Tim, this was very much informative !!!

  20. Thehunting Lion
    December 14, 2012 at 6:17 am

    Never tried, but if this wud really work, this cud be life saving app one day.. :)

    • Tim Brookes
      December 14, 2012 at 7:07 am

      You never know how valuable a tool is until you really need it, and this is definitely one to remember.

  21. armin ahmadi
    December 14, 2012 at 5:03 am

    PhotoRec is the best solution!

    • Ganesh Mobu
      December 24, 2012 at 2:10 pm


  22. Junil Maharjan
    December 14, 2012 at 4:42 am

    I have been using Recuva and it is the best in my opinion. Its free and has a great gui and is also very easy to use.

  23. William Boggess
    December 14, 2012 at 4:34 am

    I have used PhotoRec on several occasions to salvage drives for friends. One time I recovered a 500GB usb drive full of photos and movies for a neighbor. The drive had been reformatted and partially written to but PhotoRec was able to recover almost all of the photos. It took the better part of a day for it to work its magic but it worked like a charm. It is probably the best recovery tool I have ever used.


    • Tim Brookes
      December 14, 2012 at 7:06 am

      Thanks for your comment. Yikes, 500GB?! That's a lot of data to lose. Good job there are free tools like this around eh?

      • SoftwareDemons
        December 17, 2012 at 5:01 am

        I know other ways of recovering data too, with paid software without buying :D

  24. SoftwareDemons
    December 14, 2012 at 4:19 am

    I thought only Recuva is free and best, Thank you for such a valuable information.

    • Tim Brookes
      December 14, 2012 at 7:05 am

      Recuva works fine if you're a Windows user, for Mac and Linux then PhotoRec is one of the few free tools. I'd recommend it to Windows users too, though!