How to Repair MBR (Windows Boot Loader) From Ubuntu

August 1, 2013 — 17 Comments

This simple tutorial shows you how to repair your Windows 7 boot loader (MBR) from Ubuntu dual boot or Ubuntu Live CD / USB. This can be useful if you don’t have a Windows CD or DVD on hand.

To do so, first boot into your Ubuntu system. When you’re in Ubuntu, press Ctrl+Alt+T on your keyboard to open terminal and follow below steps:

1.) First run below command to check your disk:

sudo fdisk -l

The output tells you the disk information:

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x016c8108

Device Boot Start End Blocks Id System
/dev/sda1 * 63 39054014 19526976 7 HPFS/NTFS/exFAT

2.) Now run commnad to install syslinux, which is a suite of lightweight IBM PC MBR bootloaders for starting up computers with the Linux kernel.

sudo apt-get update; sudo apt-get install syslinux

install syslinux to fix mbr

3.) Once installed, you can fix your Windows bootloader by running below command in terminal:

sudo dd if=/usr/lib/syslinux/mbr.bin of=/dev/sda

Replace the startup disk name /dev/sda in the above command according to the output in step 1.



I'm a freelance blogger who started using Ubuntu 5+ years ago and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me on Google Plus or email to

17 responses to How to Repair MBR (Windows Boot Loader) From Ubuntu

  1. THX Ji…
    You saved me a lot of problems!! a bit more complicated in Windows 7 to resolve the MBR

    I know this is an older post but I do hope you will se this!!

  2. Only output I got was:

    0+1 records in
    0+1 records out
    440 bytes (440 B) copied, 0.0406588 s, 10.8 kB/s

    Is this right? If so, maybe the MBR wasn’t disrupted to begin with?

  3. Well done, now my system is damaged. Thanks

    • My Win7 Start installation instead was back and perfect booting. It worked at the first run (only had to change sda to sdb for usb drive).
      Thanks a lot

  4. Does your solution work for having ubuntu grub problem having dual boot

  5. Hi Ji m,
    Thanks a lot friend, saved a lot of time for me!
    But why this misleading syslinux name?
    Thank you once again!

  6. @Nawid
    I have had dual boot problem and worked like a charm. :)

  7. Hi,
    dose it work on new Ubuntu 14.04.02? I try do it at Ubuntu 15.02 but i’m still have a problem. In the last command it show me: dd: failed to open ‘/usr/lib/syslinux/mbr.bin’: No such file or directory.
    Can you help me?

    Thank you very much

    • Hi Jacob,

      I got the same error.
      I’m using SuSe Linux instead of ubuntu. And they put the mbr.bin into another directory.
      try to find it:
      sudo find / -name mbr.bin
      and it will show you the correct path. (In my case /usr/share/lib/syslinux/mbr.bin)

      But anyway it didn’t solve to problem. System was rebooting in a loop.
      But I hope it will work in your case.

      kind regards

  8. I just wanted to also say thank you for this little gem. It worked for me. I’m glad to have my windows back. Wow, that sounds like such a generic/filler praise but it’s true.

  9. Worked like a charm! Thank you so much!

  10. In Ubuntu 15.10, /usr/lib/syslinux/mbr/mbr.bin

    They added 1 directory.

  11. doing this from Linux Mint ruined the partition:
    error: no such device: 4a4091blablablablabla
    Setting partition type to 0×7
    Press any key to …

  12. Thanks Its just works !!! in my case i just change the path sudo dd if=/usr/lib/syslinux/mbr.bin of=/dev/sda TO sudo dd if=/usr/lib/syslinux/mbr/mbr.bin of=/dev/sda and it gives my laptop to boot my windows.

  13. THX! You saved me a lot of time and my work.

    For Debian Jessie modify the path to dd if=/usr/lib/syslinux/mbr/mbr.bin of=/dev/sda

  14. Managed to delete the linux partitions (including the grub /boot folder) from my a dual win 7 & ubuntu system right before the final stage of upgrading to windows 10.

    grub rescue>

    This worked beautifully from a live USB stick and on the next reboot the windows 10 installer finished the job. Nice save ..

  15. Hi all–

    I found help like this post for repairing the MBR on my hard disk via the syslinux mbr.bin package, and after rebooting successfully ran into something else unexpected which I’m curious to know is related to this repair.

    I have this one particular hard disk which had an MSDN copy of WinXP and DDK onboard, and when rebooting Windows after the MBR repair got blocked from logging in to validate the copy of WinXP, but that OS is not supported by MS anymore.

    I had not seen or touched the disk in many years, though it had been a Windows driver development disk a while back, and had previously been validated for XP. Is it possible that the MBR repair reset the XP validation?


Leave a Reply


Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>