LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Help! Grub Hates Me! (https://www.linuxquestions.org/questions/linux-newbie-8/help-grub-hates-me-302062/)

paul_dundee 03-15-2005 07:23 PM

Help! Grub Hates Me!
 
I have just deleted a partition on a second hard disc using partition magic 8 in windows. i rebooted, all i get now is
Code:

grub >
can anyone help as i am loathed to reinstall again!

reddazz 03-15-2005 07:54 PM

You probably deleted the partition that had the /boot/grub/menu.lst that contains info that grub uses to boot up the OSes you have installed. If you want to totally remove grub, then boot from a windows startup disk and do "fdisk /mbr". If you still have linux installed and want to boot it you may have to use your distributions installation disk to chroot into the Linux root partition and try to recreate the /grub/menu.lst.

chbin 03-15-2005 08:19 PM

Or you can use the grub command line?

grub > root (hd0,?)
where hd? is the partion you installed linux kernel into
if you not sure try them all 0, 1, 2, etc ... until you get something that says ext2, ext3, or reiserfs detected.
grub > kernel /vmlinuz ro root=/dev/hda?
where hda? is most likely just whatever worked in the previous command + 1
by the way grub has tab completion so after "kernel /" ... hit tab .... so what your chooses are.
grub > boot
umm, linux is now booting!

chbin 03-15-2005 08:32 PM

oh if you can't find any linux partitions ext2, ext3, or reiserfs then you are going to have to reinstall linux.

raellis 03-15-2005 08:34 PM

reply to Paul Dundee
 
Well, my copy of Partition Magic 8 is sitting in the Win98 subsection of this machine, where I can't check it to see if it's got some sort of partition recovery tool, but let me suggest this:

IF you just inadvertently deleted the partition without also actually destroying its contents with a shredding or zero-fill sort of action, and IF you happened to write down the precise boundaries of the deleted partition (if it was immediately adjacent to other partitions, you can probably deduce what the boundaries were from the listing provided by the "p" option of the Linux fdisk utility), AND if you know what sort of partition it was (probably ext3 and very likely "/boot," since grub doesn't even load), you just might try re-creating the partition with Linux fdisk. You can do that from the Linux Recovery option in your distribution software. If you figure out precisely what the partition parameters are, then you may be able to tell your system to look for a partition in this location. Then, if you're lucky and if nothing else has overwritten the contents of the deleted partition in the meantime -- I'd avoid all attempts to write to this disk until you have a chance to try out this solution -- you just might try to boot Linux again and find out that it works...

Something similar just worked for me. I'd screwed up my MBR, trying to add a really large partition on a really large drive and forgetting that the software I was using (not Partition Magic 8) wasn't smart enough to handle the situation. The drive was marked "BAD" by PM8, which refused to do anything with it. So I used Seagate software to zero out the MBR and then started recreating everything again, using exactly the same specs as before. This installation has more than 10 partitions and toward the end I defined several of them at once. In each case I'd restore a partition from a compressed image file backup, check it, and then go on to the next partition... so, having defined the last three partitions, I was checking the restore for the first one in the set and just on a whim took a look at the second one, too... and it was already restored even though I had not copied it back: the code hadn't changed, and defining the partition told the system where to look for it, so voila, once defined it was restored too...

These tips should give you a general sense of what this possible solution takes. They gloss over the precise steps they entail. Let me know if you need more specific advice.

Notes:

1. Remember that like any sort of partition creation, the machine will have to be restarted before the changes written to the disk's MBR can be recognized.

2. In this situation you do NOT want to re-create a Linux file system for the partition or to perform any other actions like formatting that could write to the space occupied by the lost partition. Keep in mind that the stuff IN the partition may still be there; the only thing that's missing is information in the drive's MBR that tells the system to look for a partition in this location.

3. I can see lots of possible reasons why the above approach might fail. Your message is short and so one doesn't know exactly what you were trying to do when you wiped out the partition, or what you have tried to do since. Still, there would seem to be a chance that you could recover without a reinstall.

4. Unless you've already used the machine a lot, so that there are a lot of user files in it, or you've put a lot of work into customization or additional software installations, then is reinstalling really all that much work? It might not be any worse than other alternatives.

chbin 03-15-2005 08:34 PM

or if you don't want linux anymore put in the xp cd and enter the system restore prompt or whatever you call it and do a fixmbr.

paul_dundee 03-16-2005 04:08 AM

Quote:

Originally posted by chbin
Or you can use the grub command line?

grub > root (hd0,?)
where hd? is the partion you installed linux kernel into
if you not sure try them all 0, 1, 2, etc ... until you get something that says ext2, ext3, or reiserfs detected.
grub > kernel /vmlinuz ro root=/dev/hda?
where hda? is most likely just whatever worked in the previous command + 1
by the way grub has tab completion so after "kernel /" ... hit tab .... so what your chooses are.
grub > boot
umm, linux is now booting!

i have tried all of the above, hda6 and hda7 are showing as ext2fs, partition type 0x83. When i try kernel/vmlinuz....etc i get "error 15: file nout found."

Is there anything else i can try without reinstalling? I had this problem before and had to reinstall, i would rather know how to fix it in case i have the same problem again. Plus i have files in my user dir that i don't want to lose.

harken 03-16-2005 04:37 AM

Try the following at grub's prompt to find out where it is installed: 'find /boot/grub/stage1', This should return something like (hd0,0), which equates to hda1. If you say hda6/7 are ext2 you should get (hd0,5/6).
Next you can try the steps chbin enumerated or run 'setup'.

And take a look at http://www.gnu.org/software/grub/manual/grub.html

syg00 03-16-2005 04:55 AM

Just crank up a LiveCD - Knoppix is good.
Mount any partitions you can find and see if your data is there.

Otherwis have a look at the systemrescuecd - has a heap of recovery tools.
I've also heard good things about testdisk
Fast, and seems to do partition recovery well.

gaganjain 03-16-2005 05:06 AM

boot with the linux cd and press f5 .when you get shell prompt sh#: type the following commands there-
sh#: chroot /mnt/sysimage
sh#: grub -install /dev/hda
sh#:exit
sh#:exit
the system will reboot and grub screen will be restored.

paul_dundee 03-16-2005 07:29 AM

I did get to a solution this morning before i went to work. Am not sure if windows will boot, but will test that when i get home.

I put in FC3 disc 1, typed in linux rescue. Answered the language questions and mounted at /mnt/sysimage.

Went back to sh#: followed by
Code:

sh#: chroot /mnt/sysimage
sh#: grub
grub> find /boot/grub/stage1
grub> setup(hd0)
grub> quit
sh#: emacs /etc/grub.conf

Changed parition from hda6 to hda7.

Rebooted, now into linux. Thanx guys :)

The above instructions may have varied slightly, as i am typing this from memory.


All times are GMT -5. The time now is 10:56 AM.