LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-15-2005, 08:23 PM   #1
paul_dundee
Member
 
Registered: Mar 2005
Location: Scotland
Distribution: FC3
Posts: 39

Rep: Reputation: 15
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!
 
Old 03-15-2005, 08:54 PM   #2
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 75
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.

Last edited by reddazz; 03-15-2005 at 08:55 PM.
 
Old 03-15-2005, 09:19 PM   #3
chbin
Member
 
Registered: Mar 2005
Distribution: slackware-current
Posts: 379

Rep: Reputation: 31
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!
 
Old 03-15-2005, 09:32 PM   #4
chbin
Member
 
Registered: Mar 2005
Distribution: slackware-current
Posts: 379

Rep: Reputation: 31
oh if you can't find any linux partitions ext2, ext3, or reiserfs then you are going to have to reinstall linux.
 
Old 03-15-2005, 09:34 PM   #5
raellis
LQ Newbie
 
Registered: Feb 2005
Location: Carlisle, PA
Distribution: Red Hat Enterprise WS 3
Posts: 17

Rep: Reputation: 0
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.
 
Old 03-15-2005, 09:34 PM   #6
chbin
Member
 
Registered: Mar 2005
Distribution: slackware-current
Posts: 379

Rep: Reputation: 31
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.
 
Old 03-16-2005, 05:08 AM   #7
paul_dundee
Member
 
Registered: Mar 2005
Location: Scotland
Distribution: FC3
Posts: 39

Original Poster
Rep: Reputation: 15
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.
 
Old 03-16-2005, 05:37 AM   #8
harken
Member
 
Registered: Jan 2005
Location: Between the chair and the desk
Distribution: Debian Sarge, kernel 2.6.13
Posts: 666

Rep: Reputation: 30
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
 
Old 03-16-2005, 05:55 AM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,054

Rep: Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915
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.
 
Old 03-16-2005, 06:06 AM   #10
gaganjain
LQ Newbie
 
Registered: Mar 2005
Location: noida
Posts: 4

Rep: Reputation: 0
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.
 
Old 03-16-2005, 08:29 AM   #11
paul_dundee
Member
 
Registered: Mar 2005
Location: Scotland
Distribution: FC3
Posts: 39

Original Poster
Rep: Reputation: 15
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Grub 0.97 hates my Zip disk? mhwood@Ameritech.Net Linux - Software 0 05-19-2005 12:00 AM
GRUB 00.93 Hates Me KungFuHamster Linux - Software 1 11-23-2003 04:30 AM
GRUB hates me! (RH8.0, WinXP) MagicTom Linux - General 2 02-20-2003 09:44 PM
X hates me John Galt Linux - General 8 12-20-2002 02:42 PM
X hates me tha_newbfather Linux - Newbie 4 02-24-2002 03:47 PM


All times are GMT -5. The time now is 04:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration