Skip to main content

Recover Accidentally Deleted Files From Any OS With PhotoRec


In 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 and written about Pandora Recovery, 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. 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). 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.

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 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.

First download PhotoRec and extract it to anywhere except the drive you want to recover 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).

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.

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 from, in my case it was the 2GB drive listed in the screenshot above.

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.
If 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.
Next 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.

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.

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.
Have 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.

Popular posts from this blog

How To Hide Text In Microsoft Word 2007, Reveal It & Protect It

Sometimes what we hide is more important than what we reveal. Especially, documents with sensitive information, some things are supposed to be ‘for some eyes only’. Such scenarios are quite common, even for the more un-secretive among us. You want to show someone a letter composed in MS Word, but want to keep some of the content private; or it’s an official letter with some part of it having critical data. As important as these two are, the most common use could involve a normal printing job. Many a time we have to print different versions of a document, one copy for one set of eyes and others for other sets. Rather than creating multiple copies and therefore multiple printing jobs, what if we could just do it from the same document?  That too, without the hassle of repeated cut and paste. We can, with a simple feature in MS Word – it’s just called Hidden and let me show you how to use it to hide text in Microsoft Word 2007. It’s a simple single click process. Open the document

Ex-Skypers Launch Virtual Whiteboard Deekit

Although seriously long in the tooth and being disrupted by a plethora of startups, for many years Skype has existed as an almost ubiquitous app in any remote team’s toolkit. So it seems apt that a new startup founded by a team of ex-Skype employees is set to tackle another aspect of online collaboration. Deekit, which exits private beta today, is a virtual and collaborative whiteboard to help remote teams work smarter. The Tallinn, Estonia-based startup is headed up by founder and CEO, Kaili Kleemeier, who was previously a Head of Operations at Skype. She and three colleagues quit the Internet calling giant in 2012 and spent a year researching ideas in the remote team space. They ended up focusing on creating a new virtual whiteboard, born out of Kleemeier’s experience collaborating with technical teams remotely, specifically helping Skype deal with incident management. “Working with remote teams has been a challenge in many ways – cultural differences, language differences, a

Zoom buys cloud call center firm Five9 for $14.7 billion

    Zoom is taking advantage of the impressive rise in its stock price in the past year to make its first major acquisition. The popular video conferencing firm, which was valued at about $9 billion at its IPO two years ago, said Sunday evening it has agreed a deal to buy cloud call centre service provider Five9 for about $14.7 billion in an all-stock transaction. 20-year-old Five9 will become an operating unit of Zoom after the deal, which is expected to close in the first half of 2022, the two firms said. The proposed acquisition is Zoom’s latest attempt to expand its offerings. In the past year, the video conferencing software has added several office collaboration products, a cloud phone system, and an all-in-one home communications appliance. The acquisition of Five9 — which has amassed over 2,000 customers worldwide including Citrix and Under Armour and processes over 7 billion minutes of calls annually — will help Zoom enter the “$24 billion” market for contact centers, the comp