1

Alright, I'm totally stuck now. I'm complete newbie to Linux, but I tried to learn a bit. I made a bootable USB for CentOS 7 and made a dual-boot of CentOS with Windows 10. Soon I realized that I dont have enough space for my apps now, so I decided to remove CentOS. I read online that the easiest way to remove CentOS is to delete its partition, so I did that. For my storage problem, merged all my partitions into one (something I now regret). Now, when I start my computer, it says:

error: no such partition.

Entering rescue mode...

grub rescue>

I have no idea how to deal with this. I dont have a Windows recovery DVD since I installed Windows from bootable USB (which I used later to install CentOS). I still have the bootable CentOS USB. I tried a bit with the rescue mode, but nothing seems to work. I cant even install a fresh CentOS as I'll have to format my HDD for that. Is there, by some chance, any way I can get out of this?

PS: I dont have any other computer, so I cannot install anything on the USB.

2 Answers2

0

Since you don't have an ESP partition, I presume your computer is using the legacy BIOS boot and MBR partitioning scheme. When Linux is installed on MBR drives, most of the time its bootloader called GRUB is written into the Master Boot Record, or MBR for short (that's where this partitioning scheme's name comes from, more details about the boot process in this answer).

MBR is the first non-firmware piece of code executed when your computer boots up. GRUB looks for the Linux partition to load its configuration from a file located in the /boot directory. That file configures GRUB to let you choose between Linux and Windows.

Since the Linux partition is now gone, but GRUB is still installed in the MBR, it fails and enters the rescue mode. You may be able to boot into Windows by executing these commands in the rescue mode: (confirm each one with Enter and if you see any errors, let me know in the comments)

insmod chain
insmod ntfs
set root=(hd0,1)
chainloader +1
boot

(source)

Use these to boot into Windows. Next step is to restore Windows's MBR. Prepare a Windows install disk: you can download a handy tool from Microsoft that will download latest Windows 10 image and write it to a flash drive.

Use the Windows 10 flash drive to boot your computer. On the first screen (with a "Install Windows" button) press Shift+F10 to open Command Line. Type bootrec /fixmbr and press Enter. That should write original Windows MBR to your hard disk. Close all windows and remove the flash drive when PC reboots. Windows should boot correctly.

gronostaj
  • 55,965
  • 20
  • 120
  • 179
  • Only the _set root=(hd0,1)_ seems to work; _insmod_ commands return "no such partition", while _boot_ is unknown for the system :/ – completely newbie Mar 27 '18 at 13:57
  • Oh right. I forgot that GRUB's insmod command loads modules from its partition. Then I'm afraid you're out of luck, you'll have to ask someone to make a Windows flash drive for you. – gronostaj Mar 27 '18 at 16:05
  • Just being curious, is it not possible to perform such repair using a bootable CentOS drive instead of a Windows drive? – completely newbie Mar 27 '18 at 18:08
  • Well, maybe... you could create a small Linux partition and install GRUB's files there (or just install Linux). That would make GRUB usable, letting you boot into Windows. Then you could use Windows to create a bootable Windows flash drive to erase GRUB from MBR using the method I've described above, effectively making Linux inaccessible. Finally, you could delete Linux's partition from Windows flash drive and resize Windows partition to span entire drive. – gronostaj Mar 27 '18 at 20:57
  • Anyway, you need to somehow restore Microsoft's proprietary MBR code and Linux just doesn't contain it. Theoretically it would be possible to type it by hand, but in reality it's totally unfeasible because it's way to error-prone and you need to get it somehow anyway, so basically you need another PC that could as well create the Windows flash drive for you. – gronostaj Mar 27 '18 at 21:00
  • 1
    Well, I tried using Windows Bootable media and typed in the command you said...but that didn't work. I looked up online, and found that I needed a couple more commands. So I typed _bootsect /nt60 SYS_ followed by _bootrec /fixboot_ (since writing the latter command first gave "access is denied.") Anyways, it works fine now :) – completely newbie Mar 28 '18 at 15:56
-1

I've been used to it. The best thing to do is download BootRepairDisk. Boot your computer with it (on a bootable usb or dvd). It is easy like wizard in Windows (next, next, next) to recover your Windows system.