Rewrite a Windows Hard Disk MBR with an Ubuntu 9.04 Live CD

There have been a few times in my life as a computer professional where windows just plain wouldn’t start up due to the Master Boot Record being corrupted or lost. This can occur via viruses, improper disk cloning or improper backup restores. Generally in these cases, the fix is quite easy. You boot the original installation CD’s repair mode and for Vista or Windows 7, let it diagnose and fix itself. In Windows XP, run fixboot and fixmbr from a command-line. Generally, the system starts up just fine after having completed those steps. In fact, I just had to do it recently with my laptop running Windows 7 because Acronis Trueimage 9 does not support the Windows 7 operating system and restoring the backup did not restore the system to a bootable state.

Today, I ran into a problem where I had a hard drive with an image of a Sys-Preped Windows installation on it. This disk had to be migrated into VMWare’s ESX 3.5 server. The challenge here, is that there is no direct way to clone the physical disk into the ESX server using VMWare Converter. I also looked into the no longer supported VMWare Disk Mount utility. The solution I needed to try, involved creating a blank virtual machine and loading the files into the disk over a network share through an Ubuntu Boot CD. This document will outline part of the setup process used to make the hard disk bootable.

This process should work if you are trying to make a blank disk bootable, or if you have an existing disk with a damaged MBR.

Configure the Virtual Machine to use the Ubuntu 9.04 Installation ISO as its CDROM media. If you are working with a physical computer, you will need to put a CD with the burned image of the ISO file on it and boot the CD.

Choose to “Try Ubuntu without any change to your computer”

You will be booted to the Gnome Desktop. This is where we will begin our work.

Open a Terminal.

Type: sudo bash

Press Enter (No password will be required)

Next, we will install some packages and the utility we will need to write the MBR. Please note that you will require an internet connection to complete this step.

Type: aptitude install build-essential gettext

Press Enter.

Press Enter again when prompted to confirm the installation of these packages.

Now, start Firefox. It will be in the tool bar at the top, next to System menu.

Browse To: http://ms-sys.sourceforge.net

Go to the Download Page.

Click SourceForge Download under “Current Version”

Click OK when the download window pops up.

Choose Extract.

Click Extract.

Close out of the archive application and switch to the terminal.

Type cd ms-sys-2.1.4

Press Enter.

Type make.

Type make install.

You are now ready to get started with rewriting the MBR!

Type: fdisk –l

Note the boot device. (it will have the *)

Run ms-sys: ms-sys –m /dev/sda (where sda is the boot device you determined above)

You will see a confirmation that the Master Boot Record was written to disk. You can now restart your system and if all went well windows will start up.

You can leave a response, or trackback from your own site.

Leave a Reply

You must be logged in to post a comment.