I have a desktop with two SATA hard drives installed. On one I have Windows, on the other I have Ubuntu 12.04. Everything works fine. Now, I want to install one more hard drive. This is an IDE drive. After installing the IDE drive, Grub no longer points to the correct hard drive and doesn't find the boot directory, so I end up in grub rescue. In my grub.cfg the Ubuntu installation is on hd1. It seems that the new IDE drive becomes hd0. Does that mean that my Ubuntu (and the boot directory) now is on hd2 (and Windows on hd1)? If so, how can I change this in Grub so that it points to the correct hard drive? Can it be done from the grub rescue prompt? Can I boot without the IDE drive installed, edit grub.cfg, torn off the computer, connect the IDE drive and boot? If I go wrong here, can I edit grub.cfg from a live CD? Or is there a better way to do this?
Grub command line have some commands that will help you to debug this issue. Check for the list of them here: http://www.gnu.org/software/grub/manual/html_node/Command_002dline-and-menu-entry-commands.html
Now your system should boot normally. Log in and restore your boot loader from the terminal:
(use appropriate /dev/sdX name for the drive, where your GNU/Linux installation is located).
You must have an old, broken grub install on the IDE disk that is now being booted instead of the one on the original disk, which will still work fine if you tell your BIOS to boot from that drive instead of the IDE one.
The bios always assigns (hd0) to whichever drive it is trying to boot from since DOS/Windows can not boot from any other drive.