Saturday, September 24, 2011

Fix Windows MBR using Ubuntu Live CD


A damaged or corrupt Windows MBR can be a difficult issue to fix especially if you don't have a Windows Repair CD.  Fear not.  Using a Ubuntu Live CD on a USB key you can easily repair the MBR.  These instructions are for advanced users only.  Use at your own risk.

  • Boot into your Ubuntu LiveCD on your machine. Once Ubuntu starts up, go to System -> Administration -> Software Sources and enable (by checking it off) the Universal repository.
  • Now, open a terminal session (Applications -> Accessories -> Terminal) and type the following:

sudo apt-get install ms-sys
  • ms-sys is a program used to write Microsoft compatible boot records. Now you’ll need to figure out what partition is the one hosting your Windows operating system.
  • Back in the command line, type:

sudo fdisk -l
  • That will list the available partitions. You’re looking for a partition that says something like

/dev/sda1 1 9327 74919096 83 NTFS
  • The two important bits are the ‘/dev/sda1‘ which is the partition itself and the ‘NTFS‘ which tells us it’s a Windows formatted partition.  So your Windows partition exists on your drive sda and it’s partition 1. The MBR for drive sda (assuming you boot into windows using it’s native boot loader) is what you want to repair.
  • We want to fix the MBR on /dev/sda. To do so, type:

sudo ms-sys -m /dev/sda
  • You’ll want to change the ‘sda’ bit if your results from ‘fdisk -l‘ are different.  If for instance your windows install is on sdb or hda.  Once you do that, reboot the machine, removing the Live CD USB key and Windows should come back to you.


Thanks for reading.

Tom

No comments:

Post a Comment