Nov 20, 2009
Pages: 1, 2

Restoring Grub Boot Loader

free web hosting

Read Latest Entries..: (Post #12) by iGuest on Sep 18 2009, 11:14 AM.
It seems I Restoring Grub Boot Loader Ok ,heres the long and short of it:  I have this stupid anal obession of cleaning up things. I managed to make my windows xp go away from my boot loader. I have Mandriva 2009 spring editon. Of course loaded on the first past of my primary drive. I have a second drive on a seperate  IDE. It of course is  Windows XP.  So lately I have been going in to BIOS and just flipping the drives and it works fine. But I really want my windows back o...
read more.
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Open Discussion & Free Web Hosting > Computers & Tech > Operating Systems > Linux

Restoring Grub Boot Loader

masterio
Hi guys,

Few days ago my friend ask me to reinstall Windows on his computer. The problem is he has dual OS, ubuntu linux(Dapper Drake) and Windows XP. If I reinstall the Windows the Grub loader on MBR will overwritten by Windows XP. i know after reinstalling Windows we cannot boot to Ubuntu.

I'm newbie, So my question is, How we restore the Grub Loader back? I've try to boot from ubuntu using Live CD mode. But I still confuse huh.gif the step-by-step how to restore the grub.

Please help



Thanks! smile.gif

Comment/Reply (w/o sign-up)

yordan
I'm not familiar with Ubuntu. I do this kind of things with Mandrake of Mandriva.
It should be the same kind of problem and the same solution on all distros, just try my way, it's not harmful as long as you do not clik "format the hard disk".
With Mandrake or Mandriva, and probably with Ubuntu, you boot on the first install CD (or on the install DVD), choose "install or update", then choose "update", it verifies a lot of things and you see "installing the bootloader". Choose to put the boot loader on your first disk, and everything should go fine.
Hope this helped.
Yordan

Comment/Reply (w/o sign-up)

qwijibow
You Have Two Options............

1) The Usual Way....
After Installing WindowsXP, Boot a Linux Rescue Disk and Re-Install Grub with the command. "grub-install"

read man grub for more info.

typically....

CODE

mount /dev/your_boot_partiton /boot
grub-install --root-directory /boot /dev/hda



2) The Easy, 733T haX0r Linux GuRu Way....

The Boot Sector is Stored on the first 512 Bytes of the physical Disk.

so... Backup your boot sector to a file like so...

CODE

dd if=/dev/hda of=/BootSectorBackup.bin bs=512 count=1


Copy the backup file to a floppy disk / whatever.

Install Windows XP.

Boot a Linux Rescue Disk.

then Copy your Origonal Boot Sector Over whatever Garbage WindowsXP put there with the command

CODE

dd if=/BootSectorBackup.bin of=/dev/hda bs=512 count=1




If at all in Doubt... Use Method 1..
If you Make a Mistake With Method 2, you can waye boodbye to your Partiton Table... File System, and look forward to a full re-partiton and re-format.

Good Luck.

 

 

 


Comment/Reply (w/o sign-up)

masterio
Hi qwijibow,

I have tried the first method but it seems the parameter is wrong because when I run

$ grub-install --root-directory /boot /dev/hda

the grub-install just return same as we only typed $ grub-install. When run the grub shell, I saw a few command (I think) that can be used to fix grub. Like "setup" or "install",
CODE

grub> help setup
setup: setup [--prefix=DIR] [--stage2=STAGE2_FILE] [--force-lba] INSTALL_DEVICE
[IMAGE_DEVICE]
    Set up the installation of GRUB automatically. This command uses
    the more flexible command "install" in the backend and installs
    GRUB into the device INSTALL_DEVICE. If IMAGE_DEVICE is
    specified, then find the GRUB images in the device IMAGE_DEVICE,
    otherwise use the current "root device", which can be set by the
    command "root". If you know that your BIOS should support LBA but
    GRUB doesn't work in LBA mode, specify the option `--force-lba'.
    If you install GRUB under the grub shell and you cannot unmount
    the partition where GRUB images reside, specify the option
    `--stage2' to tell GRUB the file name under your OS.

grub>


I'm still confuse about INSTALL_DEVICE.

CODE
grub> setup --prefix=/boot/grub --stage2=/boot/grub/stage2 (hd0,0)

Error 12: Invalid device requested

OR

grub> setup --prefix=/boot/grub --stage2=/boot/grub/stage2 /dev/hda

Error 11: Unrecognized device string


For method 2, I'll not do it because it's to danger and can make my partition table corrupt!. So, there is another way? unsure.gif

Thanks

Comment/Reply (w/o sign-up)

xboxrulz
GRUB handles each partition as a number... so if I want to install it into the the MBR, usually it would be:

grub-install hd(0,0)


xboxrulz

Comment/Reply (w/o sign-up)

ignite
QUOTE(masterio @ Nov 15 2006, 12:55 PM) *

Hi guys,

Few days ago my friend ask me to reinstall Windows on his computer. The problem is he has dual OS, ubuntu linux(Dapper Drake) and Windows XP. If I reinstall the Windows the Grub loader on MBR will overwritten by Windows XP. i know after reinstalling Windows we cannot boot to Ubuntu.

I'm newbie, So my question is, How we restore the Grub Loader back? I've try to boot from ubuntu using Live CD mode. But I still confuse huh.gif the step-by-step how to restore the grub.

Please help
Thanks! smile.gif


If you can boot from CD, simplest method is to mount linux partitions, then chroot to it, then run grub-install.
TIP: fdisk -l will display all partitions at all drives.

In general, for any distro, even you havn't live CD, restoring can be done in such steps:
1) Find any working linux sustem
2) Create GRUB boot floppy:
# cd /usr/share/grub/i386-pc
# dd if=stage1 of=/dev/fd0 bs=512 count=1
1+0 records in
1+0 records out
# dd if=stage2 of=/dev/fd0 bs=512 seek=1
153+1 records in
153+1 records out
3) Boot from that floppy, then (quote from GRUB info page):

Once started, GRUB will show the command-line interface (*note
Command-line interface:smile.gif. First, set the GRUB's "root device"(1)
(*note Installing GRUB natively-Footnote-1:smile.gif to the partition
containing the boot directory, like this:

grub> root (hd0,0)

If you are not sure which partition actually holds this directory,
use the command `find' (*note find:smile.gif, like this:

grub> find /boot/grub/stage1

This will search for the file name `/boot/grub/stage1' and show the
devices which contain the file.

Once you've set the root device correctly, run the command `setup'
(*note setup:smile.gif:

grub> setup (hd0)


For more information type info grub

Comment/Reply (w/o sign-up)

abhay
QUOTE(ignite @ Nov 17 2006, 02:48 PM) *
If you can boot from CD, simplest method is to mount linux partitions, then chroot to it, then run grub-install.
TIP: fdisk -l will display all partitions at all drives.

In general, for any distro, even you havn't live CD, restoring can be done in such steps:
1) Find any working linux sustem
2) Create GRUB boot floppy:
# cd /usr/share/grub/i386-pc
# dd if=stage1 of=/dev/fd0 bs=512 count=1
1+0 records in
1+0 records out
# dd if=stage2 of=/dev/fd0 bs=512 seek=1
153+1 records in
153+1 records out
3) Boot from that floppy, then (quote from GRUB info page):

Once started, GRUB will show the command-line interface (*note
Command-line interface:smile.gif. First, set the GRUB's "root device"(1)
(*note Installing GRUB natively-Footnote-1:smile.gif to the partition
containing the boot directory, like this:

grub> root (hd0,0)

If you are not sure which partition actually holds this directory,
use the command `find' (*note find:smile.gif, like this:

grub> find /boot/grub/stage1

This will search for the file name `/boot/grub/stage1' and show the
devices which contain the file.

Once you've set the root device correctly, run the command `setup'
(*note setup:smile.gif:

grub> setup (hd0)
For more information type info grub






The RHEL installer provides the GRUB boot loader, GRUB (the GRand Unified Boot-loader).

/boot/grub/grub/grub.conf has a format of global options followed by boot stanzas. Here is a sample grub.conf:


timeout=5
splashimage=(hd0,0) /grub/splash.xpm.gz
password --md5 $1$/iX9y$Bkskfdsd4443gnff
default=0
title Red Hat Enterprise Linux AS (2.6.9-648_EL)
root(hd0,1)
kernel /vmlinuz-2.6.9.EL ro root=/dev/VolGroup00/LogVol00

initrd /initrd-2.6.9-648.EL.img
title Windows XP Pro
rootnoverify (hd0,0)
chainloader +1


IF ggrub-install fails for some reason try the following:

1. type the command grub and press enter

2. type root (hd0,0)

3. type setup (hd0)

4. type quit



IF still problem occures, then reinstall the grub by

/sbin/grub-install /dev/hda or use these three commands:

Have a nice day


Comment/Reply (w/o sign-up)

Vlastik
QUOTE(abhay @ Feb 27 2007, 06:08 AM) *
1. type the command grub and press enter

2. type root (hd0,0)

3. type setup (hd0)

4. type quit


root(hd0,0) means partition where kernel is stored w.m. where /boot/ directory is stored
hd0 = first IDE disk, 0 means first partition on this disk - you can use tab key to show alternatives

setup(hd0) means where to install grub to MBR, on which disk - so in this case in the MBR on the first IDE disk

Comment/Reply (w/o sign-up)

FeedBacker
Restoring Red Hat Enterprise Linux Boot Loader
Restoring Grub Boot Loader

Hi

I had dual boot system of windows xp and RHEL 3.0.After some days I have reinstalled XP.But now I want to get back RHEL 3.0 again.

How Can I restore Grub boot loader again?if I can restore the grub boot loader again,will it give me the option of selecting the operating system?

Please help me out...

-question by ruhul

Comment/Reply (w/o sign-up)

FeedBacker
Dual Boot - Solaris 10 and Windows XP
Restoring Grub Boot Loader

Hi,
I installed solaris 10 first.Then I install windows xp in another partition.When I boot my system,there is no options for os choices.It directly goes to the windows xp ,how to get os choices menu.

Thanks in Advance.

By,
Ruban demel.

-reply by Ruban

Comment/Reply (w/o sign-up)

Latest Entries

iGuest
It seems I
Restoring Grub Boot Loader

Ok ,heres the long and short of it:

 I have this stupid anal obession of cleaning up things. I managed to make my windows xp go away from my boot loader. I have Mandriva 2009 spring editon. Of course loaded on the first past of my primary drive. I have a second drive on a seperate  IDE. It of course is  Windows XP.  So lately I have been going in to BIOS and just flipping the drives and it works fine. But I really want my windows back on the boot loader line of. 

dev/sdb1 isn't working I tried that on the add feature on the second page  of the boot loader in the boot loaders "menu" for lack of better word  and then tried loading it as a  "other os windos os" of course. I tried all the ones there and it still wouldn't boot. I tried it in root too  but I think I need more info for milling around in there.

I actually didn't blow out the linux, liunx safe boot or windows. I blew out the two files that came up after a few time booting up linux  i586 , I removed them from the loaders  menu.  Then added  "clean /tmp at boot" checked on the loaders  advanced section  on the first page of the menu.

I don't think I hurt or damaged any files in doing what I've done. Could someone help me figure this out? I just want my Boot laoder to recognized Windows and boot it according to my key stroke at time of boot. 

-question by an_ok_joe

Comment/Reply (w/o sign-up)

iGuest
dual booting: Fixing Grub Boot Loader after installing windows
Restoring Grub Boot Loader

If you already have linux installed and you install windows afterwards, I found this was the cleanest and easiest way to fix my grub boot loader if I had to reinstall windows and my boot loader disappeared.

TO FIX THE GRUB BOOT LOADER:
1. Load a live CD
2. Find where the linux partition is installed (/dev/sda4)
$ fdisk -l
3. Make a directory to mount the real root partition on
$ sudo mkdir realroot
4. Mount the linux partition in the real root folder so you can access the boot loader
$ sudo mount /dev/sda4 realroot
5. Use grub-install to redirect the real boot loader to the windows boot partition (the first part of the disk sector)
$ grub-install --root-directory=realroot /dev/sda

-reply by KnogleMopwater

 


Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Pages: 1, 2
Similar Topics

Keywords : restoring, grub, boot, loader

  1. Boot Error On Customized Kernel [solved]
    (2)
  2. Ubuntu 7.10 + Windows Xp Dual Boot
    how to reinstall GRUB after windows reinstall (9)
    Ok so for a long time I had my dual boot working great, windows and ubuntu. But 2 days ago my
    windows required a wipe and clean install because of some issues, like it usually happens after 8
    months. So I reinstalled windows, well, first deleted the windows partition using the windows XP
    install CD. Then assigned a partition for windows (same size) and left the ubuntu and swap partition
    intact. But of course, windows deletes GRUB and replace it with their boot info, so now I can't
    boot ubuntu (I can't choose). How can I reinstall GRUB without having to reinstal....
  3. Three Ways To Access Linux Partitions From Windows On Dual-boot Systems
    (11)
    If you have a dual-boot Windows/Linux system, you probably know this problem: you can access files
    from your Windows installation while you are in Linux, but not the other way round. This tutorial
    shows three ways how you can access your Linux partitions (with ext2 or ext3 filesystem) from within
    Windows: http://www.howtoforge.com/access-linux-par...ns-from-windows
    _________________________________ http://dserban01.googlepages.com/linkedin....abap.basis.html ....
  4. Linux "hangs" On Boot
    (9)
    A real quick post. I just though of installing the new version of the openSUSE distro 10.2. The
    installation goes fine and after the reboot it just hangs (no HDD activity). I keep the power on
    button pressed for a force shutdown and restart the Laptop with the same option and it starts the
    desktop and i can work on openSUSE 10.2. I go home and start my laptop up and it hangs again, and
    this time 3 force shut downs and restarts didnt help either. The last time i shut down the Laptop,
    i sisnt choose to save my configurations, so that rules out an option of me screwing up ....
  5. Boot Screen Edit
    (10)
    I Installed Windows first and then SuSe linux on another partition. Now everytime i start my laptop,
    i get GRUB to load a selective boot screen of SuSe , that allows me to select : 1) SuSe Boot 2)
    Windows Boot 3) SuSe Safe Boot By default the select is made on suse and the time is 10 secs, is
    there any way i can edit the time and the order of these bootups ? I think i could do this from
    linux, but how ? Regards Dhanesh. ....
  6. Knoppix!
    Boot linux off of a cd with all software included wothout touching you (3)
    QUOTE Knoppix is a Free and Open Source Live Linux CD based on Debian GNU/Linux. Live Linux CD
    means that the computer boots and runs completely from cd. Nothing is installed on your hard drive
    in order for you to experience many of the Open Source software packages available. Knoppix
    includes recent Linux software and desktop environments, including such applications as
    OpenOffice.org, Abiword, Gimp, Konqueror, Firefox, Apache, PHP, MySQL and hundreds of other quality
    open source programs. You can dwoload it free from there website or i think you can buy a dv....
  7. Which Linux Flavour?
    Linux - Windows XP dual boot (20)
    I recently had upgraded my PC to a P4, but had restrained from going for a newer hard disk. I some
    how stuck to my old Segate 40 GB hard disk. I am about to get a new hard disk, most probably a 80
    GB. (Finally, I was able to pool some funds for the purpose). Now, why am I putting it here on the
    OS section? Well, the hard disk space is just the premise. Over that, for past couple of weeks, I
    have been using this OS called Knoppix that runs off the CD. I was quite impressed. Most of my
    work can be done on the Knoppix or similar Linux flavored OSes. I can work on al....
  8. Help: How To Dual Boot Ubuntu And Windows ME
    I am running into some troubles (5)
    I recently recieved a Ubuntu distro (Breezy Badger, 5.10) and installed it on my laptop,
    uninstalling Windows in the process as I could not resize the FAT32 partition without erasing all
    data and I loved it! After several days without the internet as I couldn't get the modem
    working I decided to reinstall Windows ME on my laptop. I resized the Linux partition and created a
    FAT32, enough for Windows and any programs, games and documents I would like, ample space really.
    The partition was created successfully and the Linux partition resized. However, I inserted the Wi....
  9. Grub Error After Reinstalled Winxp
    (11)
    I have Windows XP and Fedora 4 installed in my PC. Grub is the boot loader. Today, I decided to
    reinstall Windows XP. After the installation finished, I boot into fedora 4 with rescue disk. then..
    chroot, grub-install /dev/hda, reboot. but I could not boot into the system. It just show me this,
    grub> There is no option for me to choose. (It uses to have a list.) Then I fdis /mbr, root
    (hd0,0), set(hd0) yes, the grub menu is back. But cannot boot into both system (windows xp and
    Fedora 4) fc4: invalid compressed format (err=1) xp:disk error ,press any key to restart ....
  10. Dual Boot Question
    future gentoo/xp project (2)
    I am planning to get a second hd drive for my pc and run gentoo as well as xp. Is it possible to
    boot from a secondary drive or should i install gentoo on the end of my primary hd and then mount
    /home on the second one? other questions to follow.....
  11. Problem With Grub
    error code: 16 (5)
    this was a confusing topic to post...it is a mixture of problems...both hardware and software. and
    it has to deal with both linux and windows...but i decided to put it here because the main problem
    is the linux. i had dual booted my machine with linspire 5.0 and windows xp...since i did linspire
    5.0 last...like i am suppose to, it used the grub boot loader. i decided after a while to get rid of
    linspire and just use vpc within windows to mess around with it. so i formated the partition within
    windows (prolly not the best idea). this got rid of the os but kept the bootlo....
  12. Help Needed On Dual-boot Windows Xp With Fcore 3
    (4)
    Have any of you tried partitioning your computer drive to install Fedora in addition to windows? If
    so, I wish for some comments on how it went, or if you know information please share. I'm
    interested in trying this out. Does it in any way slow my system down? I'm currently running on
    Windows XP Home Edition...thanks....
  13. Setup Lilo To Boot Plan 9
    Dual boot between Linux and Plan 9 (2)
    Does anyone know how to set up LILO to boot another hard disk with Plan 9 installed on it? I'm
    Installing it on the other hard drive, and then hooking it up as a slave and setting up LILO to give
    me an option to boot into Plan 9 on that drive. Anyone have any ideas?....

    1. Looking for restoring, grub, boot, loader

See Also,

*SIMILAR VIDEOS*
Searching Video's for restoring, grub, boot, loader
advertisement



Restoring Grub Boot Loader

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com