Saturday, February 4, 2012

Repair Windows 7 after removing a Linux partition (Dual Boot)

I have seen the appear alot in the forums of people are running a dual boot scenario on their computers, dual-booting Windows with Linux, and no longer want the Linux system. Simply removing the paritions causes Windows to longer boot. In this article I explain how you can fix this problem.

In this article, I will show you how to repair Windows 7 after removing Ubuntu 11.10. Although, this will work regardless of the distribution of Linux you are using.




When you remove the Linux partition(s) you essentially remove the boot loader and screw up the master boot record. This need to be repaired for Windows to work again.

Contents
  1. Removing the Linux Partitions
  2. Repairing Windows Boot Loader
Removing the Linux Partitions

Boot to Windows 7 and open Computer Management. Do this by either right-clicking My Computer and selecting Manage, or simple search for Computer Management from the Start Menu. Once open, select Disk Management.



Here you will see the layout of the Hard Drive. Right-click and delete the Linux partitions. In the above screenshot, the Linux partitions are the two on the right. Windows 7 partitions are the System Reserved and C: Drive.

Once you have deleted these partitions, the space will become a logical partition, indicated by the green, remove this also.




With the now Unallocated space, you can resize the Windows 7 C: Drive partition to occupy this space. Right-click on the C: partition and select Extend Partition.


This will start the wizard that will guide you through extending the partition. At the main screen it will ask you by megabye (MB) how much you want to extend the partition by. For me, I extended it for the entire of the available space. Once you have done this, Windows is now the only OS on the Hard Drive.


Repairing the Boot Loader

Once you have successfully removed the Linux partitions, we now have to repair the Windows Boot Loader. Insert and boot from you Windows 7 DVD.


At the above screen select Repair you computer. This will take to the System Recovery Options screen.


From this screen, select Command Prompt. In this scenario, the Startup Repair function does not work. Although it detects there is a problem with the system, it does not repair the Master Boot Record or the Boot Loader.
Once at the Command Prompt, type the following:
  • Bootrec /fixmbr
  • Bootrec /fixboot
These commands repair the Master Boot Record which contain information regarding the Hard drives partitions and then repairs the Windows Boot Loader.


Once these commands have completed, reboot the computer and Windows will now boot.



If this article helped you, please leave a comment below. Also consider making a donation to keep this blog going.


29 comments:

  1. Worked well, good tip

    ReplyDelete
  2. Thanks a lot.
    Worked well :)

    ReplyDelete
  3. Thank you man!!! It worked like a charm!!

    ReplyDelete
  4. it worked thank you very much

    ReplyDelete
  5. No worries. Glad to see that after all this time, this is still helping people. Thank you all for leaving a comment.

    ReplyDelete
  6. I it will not work if We have windows instalation on extended partition or not primary partition.

    ReplyDelete
    Replies
    1. No this probably won't. This procedure assumes all partitions are primary.

      Delete
  7. super!! congrats!!!

    ReplyDelete
  8. I have done the same procedure. But it is not working.. Can you please help me?
    When I switch on my system an Error message is display as "Welcome to Grub!
    error: no such partition
    Entering rescue mode....
    grub rescue> "
    Please help me..

    ReplyDelete
    Replies
    1. It sounds like the Windows bootloader hasn't reinstated. Can you confirm that the 'fixboot' options were performed?

      Delete
  9. Thank you.

    You're still helping people more than a year later.

    Thanks!

    ReplyDelete
    Replies
    1. Thanks for the comment. It really is inspiring in that way that this blog still gets it's comments and is still helping people. Thanks again.

      Delete
  10. Saved my life! I had installed Centos 6.4 in my Windows laptop with dual-boot and it was running flawlessly, then I decide to assign more space so I tried to resize my Windows partition and then Hell opened. After trying to reinstall Linux (since I drop that partition) the only thing that was starting was Linux grub (command line) and nothing more since today.

    Thanks a lot.

    ReplyDelete
    Replies
    1. Glad I could help. CentOS is a good OS and I often recommend it for server-based systems, but still good as a desktop. All the best.

      Delete
  11. Thanks a lot buddy,it reali helped me...IF u knw the number of hours me and my buddies spent on this issue,your the bomb

    ReplyDelete
  12. Thank you! Worked great!

    ReplyDelete
  13. how can i reinstall my windows 7 after deleting linux partition ?? after using fixboot can i install my window ??

    ReplyDelete
  14. Worked so well. Nice info

    ReplyDelete
  15. Thank you very much!!!
    Pooched my Win7 after updating Kubuntu - in VirtualBox... I set VB to run the existing Kubuntu partition (because dual-booting is a PITA and soooo-1999), but the VDMK refers to the whole disk instead of just the partition (yes. not good, but it didn't work otherwise.
    So Win7 booted up fine - but I expected Kubuntu to be screwed up, but no, it came up fine too!

    So Double-Thanks to you.

    Jim Giordano

    ReplyDelete
  16. Thank you sir! It worked!!
    wanted to get rid of ubuntu 12.04 ,
    created a recovery disk
    deleted partition
    used the recovery cmd but the blog i was refering never mentioned about bootrec /fixboot hence got stuck on
    no such partition
    grub rescue>
    Thanks to your post i got my windows back!

    ReplyDelete
  17. I haven't had a computer shipped with a disc in awhile. I have no disc. So far, my only solution has been to reinstall Linux on about five gigs of the HD so Windows can boot again. Which is annoying. I'll try going into the built in Windows repair this time.

    ReplyDelete
  18. Great ... I was struggling with it..ur tip worked well

    ReplyDelete
  19. The command prompt commands fixed my problem perfectly. Thank you!!

    ReplyDelete
  20. Thank you very much it s working .. thanks a lot

    ReplyDelete
  21. Thanks - this helped me also - I figured all the first stuff out - it was the fixing win7 boot that caused me the problems... Those command lines fixed the problem.

    ReplyDelete