How to configure your grub after making a partition in your PC


Sometimes you can not boot in your PC after making a partiton . And you get stuck in a black window at the boot time .This happens because after making the partition in your Hard disk the location of grub from which the OS loads may change .

To solve this problem and to boot into your OS follow the next steps :

Step 1 . Press “e” (edit) at the start up screen when OS loads .

Step 2. In the edit window watch the grub . Let , the grub says  : root(hd0,9)

Edit this number and Try with some other combination like : root(hd0,10)    and try to load from this modification .

Trial and error to get the real grub location from where you can boot .

Remember this real number .

Step 3. Boot from an Ubuntu live cd

Step 4. Open up a terminal and write : $ cd /boot/grub

Step 5. You have to edit the grub.cfg File of this folder.So, give the grub.cfg File write permission by : $ sudo chmod 777 grub.cfg

It will ask for your password . Give the password of your User if any.

( For the previous Ubuntu versions the grub file’s name is “menu.lst”  , so in that case write : $ sudo chmod 777 menu.lst )

Step 6. Now open the grub.cfg file with an editor . Write on the terminal : $ gedit grub.cfg

( For previous versions write $ gedit menu.lst)

Step 7. Find the lines matched with your previous grub location (Let it was at root(hd0,9) or something like this ) and edit these lines with your real grub location . Say you found your real grub at root(hd0,10) . So replace root(hd0,9) with root(hd0,10)

Step 8. Save the file and restart your PC .

Wish this time you can boot to your OS properly . :)


Leave a Reply