How to reinstall and recover grub for linux after a windows re-installation

Bump on this issue again, someone asked ” how to restore my grub after i did a re-installation of windows on my machine ?”
Linux has been there for quite some time, then come windows.. and as usual, windows tend to have it
re-format for various reason after some period of time…

Yes.. linux got “yum upgrade” thingy .. but that also seem to break sometime also ( big time!!) ..
but this time not discussing on linux part..
but the question is “how to restore grub again so that i can boot again to my linux partition which is still reside
somewhere inside the disk.. ”

( luckily windows still unable to read ext3 ) *up to time of writing.. xp & vista*
else .. it would have been another messed up like “Ubuntu 9.10” … hehehe

Oh.. this is how we gonna do it..

Get a CentOS 5.4 DVD ..
or boot.iso which is smaller and can be burned into CD or
just USB if your machine support USB boot..
(apparently D630 does support USB boot.)

while loading up.. press F12.. choose to boot from DVD or USB ..
then..
linux-rescue-centos5

type

linux rescue

enter..

[ad#postad] answer few question regarding language.. keyboard..
select-lang

select-keyboard
and..
it will boot to rescue prompt..
whenever asked to enable networking or not .. select “No”.. (not needed for just this task)
select-network
then..
it shall asked whether or not to mount existing linux partitition into “/mnt/sysimage”
press “yes”
mount-sysimage

.. then it shall shows a (single user) prompt.. like this

sh-3.2#
[ad#postad] sh
ok.. now get the current disk config with

fdisk -l

it shall spit something like this..

sh-3.2# fdisk -l
 
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1        1242     9976333+  83  Linux

so that you know the disk is at “/dev/sda”

.. now let’s change to our target rootfs.
by issuing this ..

chroot /mnt/sysimage

then.. re-install grub with the following command.

grub-install --recheck --no-floppy /dev/sda

because my machine got no floppy… hehe..

sh-3.2# grub-install --recheck --no-floppy /dev/sda
Probing devices to guess BIOS drives. This may take a long time.
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.
 
(hd0)   /dev/sda

and.. that’s it.. “exit” and it shall rebooted and can see you grub again..

p/s : somehow not publishing the series of event log for today (only known to me and few others near me.. ) …
as someone had said this to me before i press publish button :
“Oh.. blog is reachable from other countries also..
so .. if you plan to write something like ‘Welcome to Malaysia‘…
then it must be kinda a wonderful thing .. hahahaha..”
( Google will somehow pick up that ..i believe.. ~ hehe )

Get Free Email Updates!

Signup now and receive an email once I publish new content.

I will never give away, trade or sell your email address. You can unsubscribe at any time.

Like

Related Post

8 Responses

  1. Arsento says:

    I liked it. So much useful material. I read with great interest.

    Reply
  2. aLe aRdHo says:

    Nice Articel, thanks for sharing 😉

    Reply
  3. watches says:

    OK. Bless you on your mission. watches

    Reply
  4. Suresh says:

    Thanks & All the Best.

    Reply
  5. jimmy choo outlet online says:

    Your article is very nice

    Reply
  6. Davein says:

    SO FUN ARTIAL

    Reply
  7. burberry bags says:

    ack Obama. Younger voters and liberals, too, but to a lesser extent. All are important Democratic constituencies that helped him win the White House in 2008 and whose support he’ll need to keep it next year. An analysis of Associated Press-GfK polls, includin

    Reply
  8. moncler says:

    I added it to favorites and i’ll be your constant reader.

    Reply

Anything to add?

X