PDA

View Full Version : Formatted 100mb linux partition by mistake



fuoms
29th October 2007, 09:39 AM
Hi guys. Need a bit of help. I bought a USB external hdd, and linux did not mount it. So I booted windows to see if windows would identify it. I got the usual 'Found new hardware' message so I opened up 'My Computer' and found a drive that windows said was not formatted. So I formatted it. Unfortunatly (or Luckily) it was my linux 100mb partition. I think that is where the kernal is stored.

Now I can't boot Linux or Windows. I booted with my FC7 installation disk and all my data is intact on another partition. Is there any way I can repair or reinstall what I had on the partition I stupidly formatted.
At the moment all I get when I try to boot is:
GRUB >

If there is anyone that can help I would be forever grateful.
Thanks

Dangermouse
29th October 2007, 10:06 AM
Hello to boot windows at the grub promt type

rootnoverify
rootnoverify (hd0,0)
chainloader +1
boot
this will get you in windows, to get in fedora you will need to redo grub, if i remember right it can be done with your install or rescue disc

http://fedoranews.org/contributors/bob_kashani/grub/

A.Serbinski
29th October 2007, 03:32 PM
http://www.gnu.org/software/grub/manual/html_node/Installing-GRUB-using-grub_002dinstall.html

You will also need to reinstall your kernel.

stoat
29th October 2007, 03:48 PM
Hello fuoms,

I agree with Dangermouse and A.Serbinski that GRUB and a kernel will have to be reinstalled and the boot partition recreated. The boot partition contained the kernels, initial ramdisks, some stage files, the splashscreen, and one more thing: the grub.conf file. Even if you reinstall GRUB and reinstall the kernel, you will still have to hand write a new grub.conf from scratch. It is not recreated by the GRUB shell or grub-install (I tried that once). Only anaconda (the Fedora installation program) creates the grub.conf. Writing the grub.conf from scratch is easier than reinstalling the whole system, but I think it will be the worst part of this episode for you.

P.S.: If you ever edited your grub.conf file using gedit /etc/grub.conf, then a copy of it may still exist in the /etc directory. You may be able to access it in linux rescue.

P.P.S: I conducted a test on a spare computer where I deleted the all of the contents of the /boot partition. When I rebooted, stage1.5 loaded and then stopped with Error 15. I then recreated the boot partition in a way similar to what you would have to do, and the system booted normally. Before the test, I transferred the kernel and kernel-headers RPMS from my F7 DVD to an accessible partition on the drive. I also copied my grub.conf there. I reinstalled the kernel using the -ivh and --force options. I created a /boot/grub directory and copied my grub.conf there. Lastly, I reinstalled GRUB with grub-install. The system then rebooted normally with the exception of a pretty splashscreen which I intentionally omitted from the test. So, it certainly is possible to rebuild a destroyed boot partition and salvage a system. You will have some logistical problems that my test did not have, but the concept will work.

fuoms
9th November 2007, 10:43 PM
Hi thanks for all your posts. Sorry for the delay, but I have a new born baby to take care of.
I tried to boot into windows using your suggestion Dangermouse and it worked. Thanks

As for rebuilding the boot partion, Stoat you really went out of your way to help. A big thank you. But I decided to re-install everything on my new hdd because of the added space. Sorry for not trying, I'm sure I would have managed with your detailed explanation. Very kind of you all. Thanks