Thursday, February 1, 2007

24 hours of stress

24 hours ago, I formatted my Linux partition. By MISTAKE. And since my life was on Linux most of the time, you can imagine the disaster if you formatted your windows partition. This is a story of how I fixed that without reformatting or reinstalling or doing anything. That was a short introduction. In-depth details coming next, ba3d el fasel :D.

Hibernation in Ubuntu messes the swap partition. To fix it I have to issue the command mkswap. Which later I understood that it does reformat the swap partition. I by mistake instead of issuing it on sda6; the swap partition, I did it on sda7 the Linux root partition. el 7ala tedahwart saree3an, and soon I couldn't login a virtual console to fix it. I didn't understand what I made wrong till I couldn't access any file or folder. The desktop was wiped clear.

That was the first hour. The next hours involved fixing the MBR, searching for undoing mkswap, recovering partition tables, recovering files, then recovering inode table, respectively. In the middle there were involved some searching in the internals of the ext3 filesystem because when I didn't find a way to recover the inode table I decided I am gonna do it myself if I had to. Anyway after less than 12 hours I had a complete copy of all the files in my Linux partition.

8 hours ago I send to alt.linux asking the how to recover the inode table. An hour ago someone replied that I should run the command e2fsck. I tried running it from cygwin over windows, I couldn't specify the correct device, non was recognized. I have had downloaded Ubuntu live CD in case I'd have to reinstall it. I used it to run the e2fsck command (similar to chkdisk on NT). It fixed it and I was able to mount it. Then I used the super-grub disk bootable CS to restore the MBR back so GRUB on that fixed partition can run again. Then I booted into my dearest Linux, and the first thing I did was that I opened Kopete, changed my nickname, then opened firefox and wrote this article.

It was really bad 24 hours of stress with nightmares that I have to reinstall all that. And before I was able to take a copy of the files, I was afraid especially cuz the last version of the OS source was on that partition.

Al 7amd llah really.

2 comments:

Ahmed M. Farrag said...

teaches u a lesson about backups :D
amazing that u could restore it and (relatively) shortly after the accident... you should use fedora :P it hibernates perfectly :P lol
Thank God u were able to restore it.. alhamdulellah...

--AMFarrag

Mohammad Alaggan said...

Ubuntu Ubuntu Ubuntu, fedora meen dah :P
yeah al 7amd llah fe3lan

* nice one "after the accident" :D it resembles a car accident la kaddar allah walla 7aga :D