First of all, this is something that happened to me and, it is just a post about how I recovered myself from the mess. You are gonna slap me if I tell you how idiotic I was to loose all my data anyway. I was updating my Linux Mint 14 laptop with Linux Mint 15 RC, which has been released yesterday by a fresh reinstall. As usual I backed up all my files in the /home/napster folder, which is nothing but my home folder, to another spare PC here and since all of my critical documents are on Dropbox and Google Drive, that part was pretty safe. Before starting gone-deadly installation, my TOSHIBA-250GB HDD looked something like the following.
The partition labelled Data was the central place where I kept all my stuff like movies, music, photos and e-books and everything as such. And this drive was 200GB in size, and it was around 99% occupied. As you see this is a pretty deadly combination that, if you accidentally lose the data, there is not much space left to stand up and do the recovery from within the disc. Anyway, this is what I did in the apocalyptic re-installation. First I booted the machine with a Linux Mint 15 RC CD-ROM and while the installation process, I have chosen Replace Linux Mint 14 with Linux Mint 15. This was somewhat a very bad thing to do, although I didn’t expect all my partitions will be lost. After the installation, I have immediately noticed that all my partitions and data are lost, forever. This is somewhat the HDD looked like after the re-installation.
I was stupid enough to use the new installation for a few more minutes and install a few applications like Chrome Browser or the VLC player. Then I realized that the situation is real worse. With each apps being used, and with each app being newly installed, I’m technically overwriting one file or the other in my old partitions. I have stopped immediately, turned off the PC and looked around for solutions. I was pretty panicked and didn’t know what to do. I have headed to some IRC chat rooms and most of them were pretty sure that, I’m never going to get those data back.
I paused for a while and the next thing to do was to audit the damages. I have thoroughly tried to recall what files did I have on the machine before loosing the partitions. I have listed all those I could recall and analyzed which of them are potentially high priority files and which of them I could afford to loose. That opened little bit of a room to settle down for a while. Because most of the files where not that critical and to be honest, almost with any of them, I could live in the absence of them. So by the evening I decided not to approach any professional companies to do this recovery process, and assigned myself to give it a try.
Boring Story is over, You may read from here on.
For the sake of safety, I have gathered a 500GB external HDD. I thought I could use it in case if I need to profile the entire hard disk to an image. The most important tool to use was testdisk. This is an elegantly written open source software, which is the only tool I used in the entire process of the recovery. I have found a lot of threads discussing data loss due to the same incorrect Linux installation attempts. But none of them lead me to a proper recovery solution. Most threads where flooded by commercial data recovery companies and their sucky ads. So, I have found testdisk on the Ubuntu’s data recovery guide. But it was not at all documented there. I have setup a virtual machine quickly to get myself familiar with the interface of the testdisk tool. It is infact a 100% command line tool, with menu like interface much similar to what is provided by parted or such tools. I don’t know why I choose testdisk since the other two tools (one was gparted - I knew it was of no use) were documented there properly. Anyway I headed to the testdisk wiki and learned how to do the Deep Search process for the lost partitions and how to write the partition table back to the disk itself. The following were the major steps in the process.
Ok, so that’s the story, I have executed all the steps above, and successfully recovered almost all the files without being corrupted. I faced some boot related issues after the recovery, but I’m not sure yet if it is caused by the recovery process or not. Also, the most important files were recovered and so, a bad day became a good day afterall for me! :)