Saturday, January 29, 2011

How to Install / Reinstall Windows after Ubuntu

I have a laptop with two OS installed on it: Windows 7 and Ubuntu. After some drivers problems I had to reinstall Windows 7. Before that I, made some research over the net of how to reinstall Windows after Ubuntu. I find a couple of sites with very useful informations, but as you can imagine, they did not worked smoothly. So here there are the combined steps which will help you reinstall Windows after Ubuntu installation:

1. (very important step) Back-up your important data for both Windows and Ubuntu files, setting, bookmarks...

2. Create an NTFS partition for windows (using fdisk, GPartEd or whatever tool you are familiar with). This step is already done because we have Windows installed on an NTFS partition.

3. Backup the MBR
Normally when Windows is installed after Ubuntu the "Master Boot Record", MBR, will be overwritten. You can save the MBR before installing Windows.
3.1. Boot from Ubuntu and run command: sudo dd if=/dev/sda of=/mbr.bin bs=446 count=1

4. Install Windows

5. Restore the MBR
5.1. Boot into a LiveCD
5.2. Mount Ubuntu root partition in the LiveCD (mbr.bin file was saved on Ubuntu partition). The simplest way to do this is by accessing Nautilus and click on the Ubuntu drive. Ubuntu will give a name for the Ubuntu partition something like 96be32...
5.3. After you mount Ubuntu partition, you have to restore MBR:
e.g. sudo dd if=/media/96be32.../mbr.bin of=/dev/sda bs=446 count=1

6. Restart and dual boot will reappear. Now you can boot Ubuntu.


No comments:

Post a Comment