Use Ubuntu and Lilo to restore the Windows MBR


Have you ever deleted a Linux partition, and now Windows wouldn’t start? This was a recent experience of mine.

I was dual booting Windows 8 and Linux, and decided to wipe out Linux and stick to VM’s. When I erased the partition with Linux on it, Grub no longer booted Windows and I was prompted with a weird error that interrupted the boot process. Where the fuck did Windows go?! When I installed Linux, Grub had overwritten Windows MBR.  Fan-fucking-tastic.  So I thought to myself, Fusion, why not have a little fun with this, use Linux to overwrite Grub, and restore the Windows MBR? I didn’t have a copy of Windows immediately available to me, either. However, I had a copy of Ubuntu 12.04 on a 32GB USB drive (waste of space, but whatever), so I booted into live mode, and used Lilo to restore the Windows MBR.

Lilo is an older Linux boot loader, it’s short for Linux Loader. You can read all about it here. Theoretically, you should be able to use just about any version of Linux for this, but computers can be anal sometimes. You guys are smart, so I’m not going to bother showing you how to boot from USB.

This is how I did it. And it’s pretty fucking simple and takes less than five minutes.

A. We want to install the latest version of Lilo. As previously mentioned, I am using Ubuntu, so I run a quick apt-get update.

[box_dark]sudo apt-get update[/box_dark]

B. Now that the software repository is up to date, we need to install Lilo.

[box_dark]sudo apt-get install -y Lilo[/box_dark]

You are going to be prompted with this message, ignore it. Lilo will work fine for executing this type of task.


C. After Lilo is installed, run fdisk -l to check the partition table.

[box_dark]sudo fdisk -l[/box_dark]

This is the type of content that fdisk will output with that instruction. Since I am using a SATA SSD, mine is listed as /dev/sda. If you are using an IDE HDD (who uses IDE anymore?), your device id will be /dev/hda.


D. Now that we know our drive is recognized by Linux as /dev/sda, we can use Lilo to restore our MBR. Under the device boot column, there is a number attached to each block device id, these identify the partitions on the drive. Don’t bother specifying a partition, it won’t work. Just input the block device id itself.

This is the baby-making-magic-sauce that is going to overwrite Grub and restore the Win Master Boot Record.

[box_dark]sudo lilo -M /dev/sda mbr[/box_dark] 

lilo mbr

And that’s all you have to do. Reboot your system and Windows will start up like it normally should. If you have any questions or problems, feel free to express them in the comment section below.

Have a good day, —edited for potential employment as requested—


About Author


  1. Pingback: Arch | BEYOND

Leave A Reply

Welcome, guest maybe you should register or login