HOWTO: How to erase, un-install GRUB from MBR to restore Windows/DOS bootloader
Purpose: Dual-boot setup in which you have Windows and Linux installed on the same hard drive (on different partitions) is a very common technique. Many people decide to un-install Linux and that’s when they get into trouble. They can’t seem to get rid off GRUB from the MBR and whenever they try to boot from the hard disk, GRUB will try to load again and again. GRUB won’t even go away even if you format delete all the partitions from your hard drive and format them.
Basic Concept: When we install Linux and GRUB (a type of bootloader), GRUB usually installs itself on your disk’s MBR (Master Boot Record) and then if you have Windows installed you can chainload the Windows bootloader from the first sector of the partition on which Windows is installed. Normally, the bootloader is installed on the first sector of the partition on which an Operating System is installed.
Note: Before you proceed ahead with this post, please make sure that your hard drive is always Primary Master i.e. C: drive.
There are 3 ways by which you can easily remove GRUB from your existing hard drive. I will start with the most easiest one:
Method 1: Use a MS-DOS disk or Windows 9x floppy
Get hold of a MS-DOS 6.22 disk or a Windows 9X start-up disk. Boot from the floppy drive on your system with the hard drive attached and give the following command:
# fdisk /mbr
The above command will over-write the MBR meaning that GRUB will now disappear and you will most likely have your Windows XP boot menu back or DOS will book.
Method 2: Use a Windows XP installation CD/DVD
Grab a Windows XP installation CD and boot from the CD with the hard drive attached and select the “Repair” (choose “R”) option when it is presented to you. After that you will taken a common prompt. Once you get to the command prompt give the following command after selecting “1″ for :
1) C:\WINDOWS
and now type the following commands:
C:\WINDOWS> CD ..
C:\> FIXBOOT C:
C:\> FIXMBR
C:\> BOOTCFG /rebuild
The last command (BOOTCFG) will rebuild your boot.ini as per your hard drive partition table and will put appropriate entries for Windows XP. Also this command will most likley add a new entry to your Windows XP boot menu. You can easily delete the old entry by modifying the C:\boot.ini file once you successfully boot into Windows using the newly created entry.
Note: You will need to know the “Administrator” password before you can enter into the command prompt. If you don’t have one, just press “Enter” key.
Method 3: Use Linux dd command
Lastly you can use the powerful “dd” comamnd in Linux. For this the best thing to do is to boot from a LiveCD with your hard drive attached and give the following command:
# dd if=/dev/null of=/dev/sdX bs=446 count=1
Where
X = Your hard drive device name
You can use the following command to find your hard drive letter:
# fdisk -l
Output:
Disk /dev/sda: 750.1 GB, 750155292160 bytes
255 heads, 63 sectors/track, 91201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x90ee8262
Device Boot Start End Blocks Id System
/dev/sda1 * 1 18237 146488671 7 HPFS/NTFS
/dev/sda2 18238 67366 394628692+ 5 Extended
/dev/sda5 18238 66880 390724866 83 Linux
/dev/sda6 66881 67366 3903763+ 82 Linux swap / Solaris
That’s it. Hopefully by using any one of the above 3 methods you should be able to get your Windows booting back.
Happy GRUB-erasing!

Free Email Subscription









September 5th, 2009 at 7:48 pm
This is most simple.Use the XP CD or DVD.Put it in your rom drive while windows is running and RESTART your computer.When you restart and you get to this option.PRESS ANY KEY TO BOOT FROM CD.Once you get started don’t get Nervous!! The CD STARTS loading and then it will give you 3 options..SELECT REPAIR by hitting the R on your keybored …It will open the recovery counsole…It will say 1:C:\windows….Select 1 on your keyboard..Then it will ask you for your password…It is the PASSWORD you use to log into windows on the display screen…It’s what you click onto ….If you don’t have a PASSWORD then just hit enter on the keyboard..When you get to the next command…It says C:\WINDOWS and has a sguare at the end off it…At that time enter FIXMBR at the end of that so it reads like this (C:\WINDOWS\FIXMBR……….USE upper case letters and NOTE–If you are using a USB keyboard you can not do a dam thing..CAUSE it wont work untill your system is loading)Your next command is Y (The console asks if you want to continue).After hittin Y you will get C:\WINDOWS…Again So just type EXIT and hit enter…And walaaaaaa….You computer will boot right into WINDOWS…Also Remove the CD from your Rom as soon as possible..IF you want these directions go here(http://www.ehow.com/how_2305611_uninstall-grub-bootloader-from-dual.html THIS IS FOR WINDOWS XP …..IT’S That easy!!!!!!!! Just fallow the onsreen prompts and you will be fine….
Reply to this comment
September 13th, 2009 at 1:53 pm
None of the methods described here works. I’ve tried them all and no way, the MBR won’t get fixed, and that fuc***g grub simply won’t let go. error 22 still there.
Next time someone will plause linux in front of me i’ll smack him so hard….
Linux is the most useless operating system ever! it simply DOES NOT WORK! the only thing you can manage to do with it is crashing your PC.
now, back to the question: you guys really, please, have any idea on how to fix this grub thing? really? please?
Reply to this comment
Randolph Reply:
September 21st, 2009 at 8:06 am
Paolo…If you are getting that error code 22..Then you must have tried to delete the partition out…Do not do that..because it also erases the MBR for Windows. Put the Linux back on and then Switch over to the XP if that is your OS..Then follow the instructions from above.If you are having any trouble loading the recovery console. You can pre-install it by doing this. With windows running insert your disk in the cd-rom and then click on start and then run.There insert D:\i386\winnt32.exe /cmdcons. Leave a space between exe and the forward slash.What this will do is give you the option in the operating systems for the Recovery Console..
Reply to this comment
September 20th, 2009 at 7:31 pm
[...] Dica retirada de: http://blogs.koolwal.net/2009/06/08/howto-how-to-erase-un-install-grub-from-mbr-to-restore-windowsdo... [...]
October 26th, 2009 at 5:43 pm
With XP (home) on my Acer tm 4150 I added Ubuntu. Too unwieldy compared with the Unix I used in the ’80s! It had to go.
I used its “Uninstaller” I got my disk space back (I run “Puppy Linux” now from a CD) but GRUB is still there! Machine came with no XP setup CD. Spent the whole day uncompressing 800MBytes of code (directory by directory!) found on C:\i386. Finally I could run winnt32.exe without unfound file messages and successfully installed the repair console. BUT, on using fixmbr, I get the warning mentioned above. Is the grub loader sufficiently “Foreign” to spook fixmbr? The XP runs OK it’s just that I want a clean boot! HELP!
Reply to this comment
October 27th, 2009 at 8:28 am
Lordoxford..first you mostly will need an XP cd..Your MBR most likely needed some files in order to do the complete repair.However,You could do this..Find someone that has an XP cd and then fix the MBR with that cd in the drive.That way after you put FIXMBR into the recovery console The cd will run just briefly like mine did.
Reply to this comment
October 27th, 2009 at 8:33 am
Honestly, instead of going through the convoluted Windows XP CD method, just get create a DOS 6.22 bootable floppy and give fdisk /mbr. Works every time like a charm.
Reply to this comment
December 13th, 2009 at 5:13 am
I had this same stupid problem where I had tried everything that the forums were saying but with no luck. Then I though to myself, what if grub is written on a different hdd than the one I have windows installed on (which is c:), and my bios reads that hdd before my hdd c: that windows is on. well i went to the bios and changed the order in which the bios boots the hdd’s and happy days.
Reply to this comment
dogie015 Reply:
February 6th, 2010 at 2:59 pm
Another way you can change the boot order of multiple HDD’s (NOT PARTITIONS ON ONE HDD) is to modify the jumper settigs on the HDD (I have a system with one drive for the OS set as “Master” and another drive for storage set as “Slave”. There should be jumper diagrams on the HDD itself that shows these settings.
Reply to this comment