Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've had a running problem with removing Linux from my Windows 7 laptop. Initially, it was installed as a dual-boot, and worked well. To remove, I deleted the partitions on my laptop. This removed grub, and I was left with needing to enter:

set root=... 
set prefix=... 
insmod normal 
normal

each restart. I didn't restore the Windows boot-loader and have since re-partitioned my drive.

Now, upon reaching the command prompt screen, an ls query showshd0, with three partitions, but none of them have a recognizable boot-loader as each returns with error: unknown file system.

Booting from a Windows 7 rescue disk doesn't seem to work, as it sends me to the same command prompt terminal.

All I'm looking to do is restore the boot-loader, either grub or Windows 7. Any help would be appreciated.

Thanks in advance.

share|improve this question

2 Answers 2

  1. Boot up using an Ubuntu live CD
  2. Open up a terminal and become superuser (you can use sudo -i)
  3. If you are on an EFI-based machine, type grub-install /dev/sda. Note that this will obliterate your current boot option (which shouldn't be a problem for you).
  4. If you are on a BIOS-based machine, mount your linux partition, then cd /path/to/mount/point. Then, run grub-install /dev/sda --root-directory=. Note that this will wipe out any bootloader you already had installed. This should theoretically work on FAT partitions and EXT2/3/4 partitions, but try your linux partition to be safe.

When you reboot, Windows will not be shown in your boot menu. From the question, I cannot tell whether or not you tried to uninstall it, but after you boot, run sudo update-grub.

share|improve this answer
    
Simply grub-install /dev/sda will never work from a LiveCD, the partition which will contain /boot/grub/ needs to be mounted, and the correct --boot-directory option given to grub-install, no matter what platform you're installing grub on. When installing grub-efi you need also need to mount the EFI System Partition. Also, since the OP says that they deleted the Ubuntu partition, installing grub doesn't make much sense to only boot Windows, and installing grub with /boot/grub in their Windows partition, while possible, would require an additional step of writing an appropriate grub.cfg. –  Jordan Uggla Sep 4 '12 at 7:40
    
Simply ... not correct. On EFI machines with a standard boot partition, it may work (it certainly does for me). The --boot-directory does NOT need to be given when installing grub, on either EFI nor BIOS (I have done them both). Also, grub is able to run from FAT partitions and (theoretically) NTFS partitions as well, considering the installer generates an image with the required modules built in. Please educate yourself before downvoting. –  Relish Sep 5 '12 at 2:34
    
Actually, this kind of worked for me. I didn't mention that I primarily use Windows, but would like to keep my machine as a dual-boot. What I ended up doing was booting up using the Ubuntu Live Cd (as suggested) and installing it to the hard drive as a dual-boot. From here, grub allowed me to boot to Windows, where the MRB was repaired. @JordanUggla –  Jonathan Sep 5 '12 at 19:38
    
"The --boot-directory does NOT need to be given when installing grub, on either EFI nor BIOS (I have done them both)." It does when you're running from a LiveCD, because grub-install needs to access /boot/grub of the installed system, not that of the LiveCD. "Also, grub is able to run from FAT partitions and (theoretically) NTFS partitions as well" Which is why I said that it was possible. We don't disagree here. "Please educate yourself before downvoting" I have contributed multiple patches to grub, and I maintain Super GRUB2 Disk. I am well educated when it comes to grub. –  Jordan Uggla Sep 8 '12 at 23:18

boot Windows 7 rescue disk. When command prompt appear type:

BootRec.exe /fixmbr

or

BootRec.exe /fixboot
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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