Boot problems are probably the most feared computer problems. Without an operating system you can't access your data, get the work done or even google for help. That's why it's often a good idea to have an alternative operating system available for searching help if the main OS doesn't work. Also a copy of Clonezilla-SysRescCD can be invaluable help.
Actually, the initial reason why I (Jyrki) installed GNU/Linux at all was that I wanted to be able to fix Windows boot problems if they occur. I installed both GNU/Linux and GRUB to my external hard drive, completely separating operating systems. Even if either bootloader stopped working, I'd still be able to boot one of my OSes.
But such configuration is not easy to create, and when I installed GNU/Linux, I knew very little about it. If I didn't read the instructions I found here and there very carefully, I probably would have done a common mistake: installing GRUB to my internal hard drive. Such mistake would have caused two problems:
- Inability to boot GNU/Linux at any computer expect the one which was used for installing
- Inability to boot Windows when the external drive isn't connected
In this page, I simulate that situation in a virtual machine and fix both problems.
What happens when I try to boot the external hard drive on another computer depends on the BIOS of the computer. For example, on my computer I see a Black Screen of Death when I try booting from a disk with empty Master Boot Record. Other BIOSes may boot the local operating system or display an error message (for example "Disk boot failure", "Missing operating system" or "Operating system not found").
The other problem is very easy to determine. When external drive is disconnected and I try to boot, I'll see this:
Because I still want to separate my operating systems completely, I try to restore NTLDR to the Master Boot Record of the internal disk, if possible. If that's not possible, I install there another bootloader that chainloads Windows.
I could reinstall GNU/Linux completely and make sure that the GRUB is installed to the right disk this time, but it's not a good idea if I only need to overwrite the first 446 bytes (yes, bytes, not kilo- or megabytes) of the disk. So, I only install GRUB to the external disk, by using Super Grub Disk.
Your problem (if you have one at all) most likely is different, but goals are often the same.
You need to restore NTLDR if you...
- ...just installed GNU/Linux, but the boot menu doesn't mention Windows at all. You're not willing to learn how Windows can be added to the boot menu, you just need to make your computer to boot Windows again right now.
- ...cloned your Windows partition to your brand new computer but didn't clone the Master Boot Record.
- ...are about to uninstall GNU/Linux and aren't willing to use GRUB as your bootloader.
You need to install GRUB if you...
- ...just installed Windows and want to make GNU/Linux bootable again.
- ...cloned your GNU/Linux partition to your brand new computer but didn't clone the Master Boot Record.
- ...just installed GNU/Linux but installed GRUB to a non-first hard drive by accident. (The symptom is that your computer still boots to the operating system you had installed already.)
The following pressentation has been made using|
Super Grub Disk v0.9799
Restoring NTLDR [^]
There are a lot of ways to restore NTLDR. However, sometimes there is no legal way to restore it, and I'm NOT telling about the illegal ones. The last resort is using syslinux to chainload Windows; there is usually no way to notice that syslinux is used instead of NTLDR.
I've listed here the most important options in order I'd use them.
Restoring NTLDR from a backup [^]
If you've been smart enough to use Clonezilla Live to create a disk image of your first hard drive, it's very easy to restore NTLDR.
Your NTLDR is safe in a file called hda-mbr or sda-mbr. You can use dd to overwrite your existing Master Boot Record.
Don't restore all 512 bytes of your Master Boot Record.|
The MBR contains your partition table and restoring it after
repartitioning your disk erases all the data on the disk.
If you normally use GNU/Linux, open terminal and run these commands as root:
mount /dev/sdc1 /mnt/usb
dd if=/mnt/usb/Backup/sda-mbr of=/dev/sda bs=446 count=1
Note: In the commands I have assumed that your first hard drive is /dev/sda and that your disk image resides in the folder Backup in partition /dev/sdc1. You will have to replace them with the correct pieces of information.
Note: How a command can be run as root depends on the GNU/Linux distribution you use. If it's Ubuntu or a distro based on it, simply put "sudo" above the command. For example, the latter of the above commands can be executed by typing "sudo dd if=/mnt/usb/Backup/sda-mbr of=/dev/sda bs=446 count=1"
If you normally use another operating system, boot into SystemRescueCD and run the above commands. In SystemRescueCD all commands are run as root, so you don't need to add any prefix to the commands.
If you don't know the name of the partition, run this command as root:
It tells how many hard drives you have, how many partitions they contain and what filesystems the partitions use. If you know, for example, that the disk where you've saved the disk image contains only one partition, look for such disks.
Using Bootrec.exe (Windows Vista/7 only) [^]
You need Windows Vista/7 install disc for this. If you don't have one (for example, if you bought a laptop that was bundled with preinstalled Windows and manufacturer's recovery disc), download a recovery disc from here.
Then boot from the disc. After selecting language, time, currency and keyboard, click Repair your computer. You'll get a list of operating systems you're able to repair. Choose any of them; that choice doesn't matter.
After that, you'll see a dialog box named System Recovery Options. Click Command Prompt. Then you only need to execute one command:
Note: The command is case-insensitive. You can type, for example, "bootrec /fixmbr".
Using FIXMBR (Windows XP only) [^]
You need Windows XP install disc. Boot from it, and when you see the screen "Windows XP Home Edition Setup" or "Windows XP Professional Setup", press R to enter the Recovery Console. Then choose the Windows installation you want to log onto. If you have only one copy of Windows installed, press 1 and ENTER. After that, enter the administator password and press ENTER.
There is only one command to run:
Note: The command is case-insensitive. You can type, for example, "fixmbr".
Using FDISK (Windows 95/98/Me only) [^]
For this, you need a floppy drive. You also need to run a Windows-only program, so your first challenge is to boot Windows without NTLDR.
Don't worry, Super Grub Disk makes it possible. Boot into it.
Just choose the option "!WIN! :(((" and press ENTER.
When you have Windows up and running, download the boot disk image appropriate to your version of Windows from Bootdisk.Com. Then put a floppy to your floppy drive.
If the floppy isn't already formatted, open My Computer, right-click the floppy drive and select Format....
At the format window, choose the capacity of 1,44 megabytes and Full format type. You can enter any label (it means the name of the floppy you can see next to the floppy drive letter) and disable the summary if you wish. Keep the Copy system files option disabled.
When you have a formatted floppy in your drive, double-click the boot disk image you downloaded. When it's done, shut Windows down and check your BIOS settings to be able to boot from the floppy. Some BIOSes contain a boot menu, others require editing settings pernamently. Details can be found on the manual of the motherboard or laptop.
Then boot from the floppy. When you're given three boot options, choose the option 2. Start computer without CD-ROM support. Wait a moment to enter command line and run this command:
Note: The command is case-insensitive. You can type, for example, "fdisk /mbr".
Installing syslinux using Super Grub Disk [^]
The above four are the only legal ways I know to restore NTLDR to the Master Boot Record. Unfortunately, sometimes none of them can be used. If that's the case, it's time to switch bootloader. GRUB can be configured to chainload Windows, and usually it even does that automatically, but this page isn't intended to help configuring GRUB. I assume that if you're primarily a Windows user and reading this page, you don't want to learn how to use GNU/Linux, you just want to make Windows bootable again.
Maybe the easiest way to do so is installing syslinux using Super Grub Disk. Super Grub Disk configures it automatically to chainload the first active partition. The partition should contain Windows, Windows can't boot if its partition isn't active.
Boot into Super Grub Disk.
Choose the option "WIN => MBR & !WIN! :(((((((((((((((((((((" and press ENTER. Windows will be booted automatically right after installing syslinux.
Installing GRUB [^]
Contrary to various ways to restore NTLDR, there is only one way to install GRUB I recommend. That's Super Grub Disk, because it contains GRUB no matter what has happened to the hard drive(s). First, I boot into it.
I select "Choose Language & HELP :-)))" and press ENTER.
Screen "S.G.D. Language Selection." [^]
I select "English Super Grub Disk" and press ENTER.
I press ENTER...
...and then ENTER again...
...and then ENTER once again...
...and finally ENTER one more time.
Screen "English Super Grub Disk (Help)" [^]
I select "Advanced".
Screen "Advanced (Help)" [^]
I select "GRUB" and press ENTER.
Screen "GRUB (Help)" [^]
I select "Restore GRUB in Hard Disk (MBR)" and press ENTER...
Screen "Restore GRUB in Hard Disk (MBR) (Help)" [^]
I select "Manual Restore GRUB in Hard Disk (MBR)" and press ENTER. If you want to install GRUB to the Master Boot Record of the first hard drive, "Automatically Install" is a better choice. If you don't know if you want GRUB to the first or some other disk, you most likely want it to the first disk.
Screen "Manual Restore GRUB in Hard Disk (MBR) (Help)" [^]
I confirm my decision by selecting "Manual Restore GRUB in Hard Disk (MBR)" again and pressing ENTER.
Screen "Partition of GRUB" [^]
In this screen I can select the disk that contains the partition that contains the files needed by GRUB. In this case, that disk is the external hard drive. As you can see, the disk is only three megabytes in size - because the computer used for screenshots is still virtual. Actually, the "disk" where I'm installing GRUB is just a file.
Next Screen [^]
This is where I choose the partition where GRUB files reside. This disk contains only one partition.
Screen "Restore to MBR of Hard Disk" [^]
I select the external hard drive to install GRUB to its Master Boot Record.
Some text scrolled in the screen (too fast to read or take a screenshot) and I was back at this screen. I rebooted the computer. (In this situation, you can safely do a "hard reboot" by pressing reset button once or power button twice.)
GRUB booted successfully.