Can't boot into Ubuntu after installing Windows [duplicate]

Possible Duplicate:
How can I repair grub? (How to get Ubuntu back after installing Windows?)

Recently I reinstalled Windows XP on my laptop which also have Ubuntu 9.10 installed, but after reinstalling Windows I was not able to boot to the Ubuntu again.

I have the Ubuntu 9.10 Live CD with me and I tried some of the tutorials I saw online but was not successfully. For example I followed the examples on this site but I couldn't make it work. Can somebody please help me?


How to restore the Ubuntu grub bootloader (9.10 and beyond)

First you need to find out what your drives are called. You can do this by going to a terminal and typing:

sudo fdisk -l

From that you need to find the device name of your Ubuntu drive, something like “/dev/sda5″. So, still in the terminal, type:

sudo mkdir /media/sda5
sudo mount /dev/sda5 /media/sda5

And then, to reinstall the grub:

sudo grub-install --root-directory=/media/sda5 /dev/sda

Push enter and you’re done! Of course you need to replace “/dev/sda5″ and “/dev/sda” with what you found in the fdisk output.

This is extracted from http://ubuntuforums.org/showthread.php?t=1014708 thread by talsemgeest.