Windows: Windows did not start. Howto write a new MBR and recover Windows OS Bootsector

Hi,

if you migrate a Windows Installation to another Computer or virtual environment such as VMWare ESXi or VMWare Workstation it could happen that the system won’t start.

A typical error when the master boot record or the boot sector of the boot partition needs to be updated or must be rewritten is when

  • After Postscreen of the BIOS the console shows “Operating system not found” this means there is no boot code in MBR
  • or it shows only a blinking cursor in the upper left edge. 2 possible reasons are thinkable
  1. MBR boot code is loaded but could not load the operation system => The boot sector of the Windows Boot partition needs to be updated
  2. The boot(active) flag of Windows boot partition  is missing

For all cases you can use the command line program “testdisk” which is part of the most linux live CDs/DVDs to correct this.

Start repairing by booting a linux live CD. I prefered KNOPPIX, but there are many other (Systemrescuecd,….) . After the system is up jump to the text console(this is recommended) by pressing Alt-Ctrl-F1. Check if you are root by execute the id command

root@MicroKnoppix # id
uid=0(root) gid=0(root) groups=0(root)

otherwise start a root shell(in graphical environment):

root@MicroKnoppix # sudo su

Check if the boot partition has the active flag. An asterisk should be in the boot column of boot partition:

fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders, total 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000e922c

Device Boot     Start         End    Blocks   Id  System
/dev/sda1    *        2048     20971519    20969471 7 HPFS/NTFS/exFAT

If not, set the active flag with fdisk. Start fdisk with the disk (usually /dev/sda) as parameter. In the fdisk command mode, “p” shows the current disk layout, “a” sets the boot flag and “w” write the changes to disk:

fdisk /dev/sda
Welcome to fdisk (util-linux 2.21.2).

Command (m for help): p

Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders, total 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000e922c

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   2048 20971519 20969471 7 HPFS/NTFS/exFAT


Command (m for help): a
Partition number (1-4): 1

Command (m for help): p

/dev/sda1 * 2048 20971519 20969471 7 HPFS/NTFS/exFAT

Command (m for help): w

To write a new MBR start testdisk, select the "No log" option and select your Disk where Windows is installed. This should be the first item in the list. Now select the partition type, for Windows installations prior to Windows 8 this should be a "Intel/PC partition". To write a new MBR select:

[ MBR Code ] Write TestDisk MBR code to first sector

If the system still won’t boot (cursor is blinking), repair the boot sector of the boot partition.

Start testdisk again, select the "No log" option and select your Disk where Windows is installed. Do the same steps as above. Choose

[ Advanced ] Filesystem Utils

Select the boot partition and choose

[boot] Boot sector Recover

following by option
[Rebuild BS] Rebuild boot sector

and write the new sector to disk.

You can also use a Windows PE environent for repairing.  Use the following commands:

Write a new mbr: bootrec /fixmbr

Rewrite the bootsector of the boot partition: bootrec /fixboot

Set the active flag on the boot partition. Let us assume, as above,  the boot partition is the first partition on disk 0.  Use diskpart

Microsoft DiskPart version 6.1.7601
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: S281308

DISKPART> select disk 0

Disk 0 is now the selected disk.

DISKPART> select partition 1

Partition 1 is now the selected partition.

DISKPART> active

DiskPart marked the current partition as active.

However, in a very special setup, 2 disks in the system, windows was installaed  at the second disk, the Windows PE way did not work for me. Testdisk did the job:-)

Michael

Leave a Reply Cancel reply