I Deleted Everything

I goofed.

I’m an avid hobbyist photographer and I happen to live in one of the most beautiful cities in the world. Needless to say, I take a lot of pictures. Recently I upgraded the drive in my home desktop from a slow HDD to 256G SSD. My workflow is like this: I take pictures, I copy the RAW files from my SD Card to my 1.5TB external drive and then copy the ones that aren’t blurry or terrible to my local hard drive for editing and the best ones that are edited get promoted to Flickr. The SSD would make this a lot easier and faster because RAW image files tend to be relatively huge and time consuming to process.

I added the new SSD, installed Tumbleweed, copied my personal files from the old disk to the new one and then deleted the files on the old disk. I had plans to use it for another project. Except one thing; I was in the wrong directory when I deleted everything. All 400GB of pictures were gone. I immediately stopped everything because I knew that deleting files doesn’t actually remove them from the disk. It simply makes them able to be rewritten and I didn’t want to risk that happening.

How I recovered.

OpenSUSE Leap and Tumbleweed have an application called QPhotoRec that saved me.

I loaded the application with the gnomesu command as it needs root access to run:

gnomesu -c qphotorec

From here I was able to choose my disk, the kind of filesystem that I was using and where I wanted the files to be restored to and then I let it run. It’s not a fast process. It took around 8 hours to restore my 400GB and even then there was two thing that I wasn’t able to restore; the filenames and their directories. All of my files had their correct extensions but they were missing the filenames that they originally had and the directories they were in. Also, files inside of other files such as .iso or .tar files were also recovered including thumbnail photos that were stored in other files. QPhotoRec tries to make educated guesses about what is and is not a file and recovered everything but it’s not perfect. My job then was to reorganize my files into some semblance of how they were previously but at least they were there again.

Mistakes happen and hardware breaks. Files get deleted, sometimes important files. The best way to proceed is to always to keep backups (all of my most important files are encrypted and on a remote server) but when disaster happens through human error or otherwise, it’s good to know that there are options.