6 Mar 2018

Data Destroyer, Testdisk, Boot-repair and Windows7

My dear readers know that Linux notes from DarkDuck is a blog mostly for reviewing Live versions Linux operating systems. Running these versions Live means I need to create Live DVD or Live USB with the disk image to boot from.

What is the most popular tool for creation of Live USB? Many of you would name Unetbootin, Pendrivelinux and some more. There was even an article on this blog with a comparative list of these tools. However, the most common tool is still a command dd.

usb key linux 1
Image of Dariolynx
In common life dd stands for Data Definition. In a less practical sense dd stands for Data Destroyer. It means that dd command rewrites all the data on the target device without any compassion.

That was the case for myself. I typed the usual command sudo dd if=... of=/dev/sdb, remembering that sdb had always been my USB drive. But not at that time. For whatever reason sdb was my primary HDD, where Windows 7 and Kubuntu 16.04 were installed.

Only after few seconds I noticed that USB stick is not blinking, which was an indicator that dd command did not use the USB stick. Where did it write to? Of course, to my hard drive! And these seconds were enough to overwrite the partition table, master boot record and a part of the Windows partition. Luckily, there were separate partitions for Kubuntu and for user data, and they were much farther in the HDD structure. Command dd did not get there before I stopped it.

Nevertheless, the laptop became unusable. I could not boot it from HDD. I had to save it. I managed to create a Live USB with Kubuntu 16.04 image using another laptop I had. But even then, HDD partition table was destroyed. Linux operating system could not read anything from the disk.

Here comes Testdisk. This is a small CLI utility to help in these situations. I installed it in the Live Kubuntu 16.04 and let it run. It took some time for Testdisk to scan my 1TB drive. I must admit that the interface of Testdisk is far from perfect, and you can easily null the scan results by pressing just one button. That made my work iterative before I finally managed to rescue my drive.

Testdisk found partitions on my HDD, and even helped me to copy files from the data partition to an external HDD. At least, I saved my data.

The next step was to recreate partition table. There were certain partitions for Linux, Linux Swap, OS restore and data. But the main Windows partition was lost, and instead I saw couple dozen broken bit-size partitions. Using Testdisk, I managed to recreate the partition table. Live Kubuntu could mount these partitions normally, which was already a big achievement. Few more files were copied from the Linux partition to the external drive, just in case.

However, the HDD still could not boot. Here came the Boot-repair utility, designed for recovery of lost GRUB installations after unlucky Windows install. It was good enough for me too, and after few minutes with it I could boot into my old installation of Kubuntu 16.04 Linux operating system.

Phew, I was at home after loosing the key! You can imagine my happiness at that time.

But not all things were smiling and dancing at that time. I had another big step: to recover Windows operating system. I already had Windows Recovery Disks that I created when the laptop was new, fresh and shiny. Unfortunately, the Recovery Disks were not able to re-install Microsoft Windows using only the empty partition I left for Windows while playing with partition table. The only way was to make a full factory reset, including deletion of all existing partitions. Of course, that meant I lost my Kubuntu 16.04 installation.

And you know what? After much thoughts and couple of days of attempts to recover the data loss after my silly mistake, I decided to abandon Linux. I am writing this post from Windows, that works well on my relatively powerful laptop. I'll let it running for me for time being. How long that will be? I don't know.

Ubuntu 18.04 LTS family will be released in just few more weeks. Maybe that will be the time to come back to the Linux world, but I cannot predict. Let's see.

In the meantime, you will not see Linux reviews on this blog for some time. Of course, there will be some other Linux-related articles, so I ask you to still stay tuned and watch this space!

You can read this article in Ukrainian too.

1 comment: