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 :
and now type the following commands:
C:\WINDOWS> CD ..
C:\> FIXBOOT C:
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
X = Your hard drive device name
You can use the following command to find your hard drive letter:
# fdisk -l
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.