Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the standard/correct way to re-install grub2?
I am using liveusb right now and i am unable to boot into Ubuntu on my hard drive.

Partitions are as follows:

/dev/sda1               1        3917    31463271    7  HPFS/NTFS
/dev/sda2            3918       10444    52428127+   7  HPFS/NTFS
/dev/sda3           10445       15671    41985877+   7  HPFS/NTFS
/dev/sda4           15672       19457    30411045    5  Extended
/dev/sda5   *       15672       17711    16386268+  83  Linux
/dev/sda6           17712       19457    14024713+  83  Linux

Pleas help.

share|improve this question
up vote 2 down vote accepted

The standard way is grub-install, so if you e.g. want to install grub on /dev/sda you would run

grub-install hd0


grub-install /dev/sda

If you use some other, additional boot manager in /dev/sda adjust the parameter to grub-install.

For some details see info grub-install.


Assuming you are installing to /dev/sda (replace with whatever partition you use), you might want to back-up your boot sector with

dd if=/dev/sda of=boot_sector.bak bs=512 count=1

so you could restore it later in case of errors with

dd if=boot_sector.bak of=/dev/sda bs=512 count=1
share|improve this answer
I have boot partition in /dev/sda5 and ubuntu also in /dev/sda5. So, i should "grub-install /dev/sda" or "grub-install /dev/sda5" ? – xenon Mar 24 '10 at 2:48
That depends on where you keep your boot manager(s). Do you use some other boot manager besides grub? – Benjamin Bannier Mar 24 '10 at 2:51
@honk: i am only using grub2 – xenon Mar 24 '10 at 2:54
@xenon: he's asking because of the NTFS partitions in sda1-3. What handles booting those? If it's grub2 for everything, then it is likely that the boot sector in on your disk is where you should install (/dev/sda instead of /dev/sda5) – kbyrd Mar 24 '10 at 3:05
is there anything else to be done after "grub-install". it completed without any errors – xenon Mar 24 '10 at 3:05

You must log in to answer this question.