This question already has an answer here:

I had Windows 8 installed on my laptop. I then installed Ubuntu 12.04 along on separate partition. After a few days I mistakenly deleted the Ubuntu partition. Now I every time I start my laptop it don't show boot options (F2 & F12). It just gets stuck at a screen showing

unknown file name 
grub rescue>

It's not booting either into Windows nor into Ubuntu.

marked as duplicate by Eliah Kagan, Eric Carvalho, Lucio, muru, mikewhatever Sep 6 '14 at 4:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • It is ordinary if you delete your Ubuntu partition from Windows (not Wubi). The solution is install the Ubuntu again or use Windows Recovery CD. – lambda23 Oct 11 '12 at 14:51
  • How to remove Ubuntu and put Windows back on? contains detailed information on several techniques for making Windows bootable again after Ubuntu is removed. – Eliah Kagan Sep 2 '14 at 5:30

mistakenly deleted the Ubuntu partition

Then re-install Ubuntu on that empty partition and problem will be solved (Ubuntu will re-write grub).

If you do not want Ubuntu anymore try search for answers on internet how to fix mbr using Windows CD (cause I'm not expert in that).

  • i tried installing Ubuntu with bootable USB stick but it's not working as my bios is not showing the boot options anymore. – Rohit Sep 13 '12 at 12:50
  • @Rohit Grub have nothing to do with your motherboard Bios. Enter to your Bios setup and re-configure device booting priority by your needs (in this case making USB higher priority than HDD). – user9440008 Sep 13 '12 at 13:01
  • I now it's the problem with my bios which I m unable to configure. Butthisis all because of this gruB thing. – Rohit Sep 13 '12 at 13:08
  • Just do me a favor buddy get me hell outta this thing. – Rohit Sep 13 '12 at 13:11

Since you deleted Ubuntu partition, GRUB (which is what shows up with all the OS options) also got deleted.

You can do either of the following:

  • Install Ubuntu again - This will solve your problem.

  • Repairing Windows MBR (Master Boot Record) - After this, you will be able to boot into Windows.

I guess you know how to install Ubuntu. But if you have any problems, ask here or look over at web or at this link: http://www.ubuntu.com/download/help/install-ubuntu-with-windows.

And the link below, provides a tutorial on how to repair windows: Link: http://windows8themes.org/repair-fix-mbr-in-windows-8-using-the-command-prompt.html.

Changing Boot Preferences

  • Keep pressing F2 (the key might be different for different machines) while booting. That should bring up the BIOS.

  • Now you need to find out something like booting preferences (might be located in Boot tab or something like that).

  • Change the first preference to CD/DVD, this will enable you to boot from your repair/install CD/DVD.

  • Alternatively, you can select the first preference to be USB, in which case you can boot via LiveUSB and install Ubuntu again.

  • But grub is somewhat related to Linux. Window is not the problem Ubuntu partition deleted. So won,t boot into ubuntuanymore or any os. – Rohit Sep 13 '12 at 12:41
  • I knew how to fix MBA but for that I have to first boot anything. I tried window repair disc and also with bootable Ubuntu disk – Rohit Sep 13 '12 at 12:44
  • It seems that the boot preferences are not in order. While booting, go to BIOS and reorder the boot preferences such that the USB or CD/DVD comes before Hard Disk. – green Sep 13 '12 at 12:57
  • Problem is with the boot menu itself. Rest I did. – Rohit Sep 13 '12 at 13:03
  • Just do me a Favor buddy get me hell outta this grub thing. – Rohit Sep 13 '12 at 13:14

Let me tell you how I fixed a similar issue I had. This should help you to fix yours too.

I have dual booting Win7 and Ubuntu12.04 which was working perfectly fine. I accidently deleted the extended logical volume(partition 4) when in Windows and there is no boot now with grub rescue prompt after I shutdown Windows.

Configuration of my Single disk with 6 partitions:
partition 1= primary partition;
partition 2= primary partition = Win7;
partition 3= logical drive in extended partition;
partition 4= logical drive in extended partition;
partition 5= primary partition = Unbuntu12.04;
partition 6= primary partition = swap

So now the partition number that grub is searching for a bootfile is (hd0,msdos7) whereas the bootfile is actually located at (hd0,msdos6) due to the partition delete.

You can check this by the command "set" at grub rescue prompt. This shows me that the partition set to boot is (hd0,msdos7).

To show all partitions use "ls":
grub rescue> ls
(hd0,msdos7) (hd0,msdos6) (hd0,msdos5) (hd0,msdos2) (hd0,msdos1)

Then check for bootfile in each partition:
grub rescue> ls (hd0,msdos7)/boot ... unknown filesystem
grub rescue> ls (hd0,msdos5)/boot ... unknown filesystem
grub rescue> ls (hd0,msdos6)/boot ... grub ... initrd.img-2.6.32-33-generic ... vmlinuz-2.6.32-33-generic....... So now we know the actual bootfile is at (hd0,msdos6).

Now set this bootlocation temporarily in bootloader and boot into the OS:
grub rescue> set root=(hd0,msdos6)
grub rescue> set prefix=(hd0,msdos6)/boot/grub
grub rescue> insmod normal
grub rescue> normal
This boots us directly into the OS.

Once I booted into Windows, I downloaded and used the free windows program AOMEI Partition Assistant Standard Edition 5.5 to restore the deleted volume. After that I restarted Windows all works fine like nothing happened.
Something funny with Windows7 here. Apparently diskpart thinks the primary partitions 5 and 6 are logical drives (diskpart>select disk 0 >list partition) whereas Disk Management shows the same partitions of Ubuntu as primary partitions.

Not the answer you're looking for? Browse other questions tagged or ask your own question.