GRUB is GRand Unified Bootloader, the default bootloader for Linux kernel based Operating Systems. If you have a dual boot system, like Windows and Linux, then you may have some issues with GRUB. If you install Windows after Linux installation, then Windows puts its own bootloader on the MBR. So GRUB is no longer visible. GRUB needs to be reinstalled in this case.
This article provides some scenarios that leave the GRUB unbootable and how GRUB can be reinstalled in order to fix the problem like getting "error: unknown filesystem".
When GRUB is unable to boot your system, or is unable to find the second stage, it drops the user to the GRUB prompt that looks like:
error: unknown filesystem
grub rescue >
First of all, you need to boot your system. At the GRUB prompt, you can run the following commands to boot your system up.
kernel /vmlinuz-2.6.18-238.el5 ro root=/dev/sda1
Of course, your version of Linux kernel and initrd file would be different. And this works on GRUB Legacy only. For GRUB 2, you would need to run the following commands in order to boot.
Here also, you will need to change the partition to your boot partition.
If you are unable to boot your system (which might be due to bad filesystem, or due to missing GRUB configuration file), you will need to boot from some other medium. You can use some bootable rescue CD or the Live CD of your distribution if available.
Once you have booted into your system, you might need to create the GRUB configuration files, if missing or if misconfigured. To create these configuration files, run
This command needs superuser privileges. So run this command (and the following commands in this article) as root.
The next step is to install GRUB on the MBR. This will fix the problem caused by Windows, in which Windows installs its bootloader on MBR, after installation of Windows over Linux. Here I assume that you have booted from the Live or rescue CD.
Now, before we go to the details of installing GRUB on MBR, we need to mount the root partition of Linux.
$ mount /dev/sda1 /mnt
Here, the root partition is assumed to be /dev/sda1. This partition is mounted on /mnt directory. You can choose your own mount point, and your root filesystem partition may be different.
Now, we are ready to install GRUB. Run the following command
$ grub-install --root-directory=/mnt/ /dev/sda
This will install the GRUB on Master Boot Record. If you wish to install it on some partition, replace the last argument of above command with the proper partition.