Q. How do I uninstall GRUB? I need to uninstall everything before sending this hard disk to someone including GRUB. All I need to keep is windows XP.
A. GNU GRUB ("GRUB" for short) is a boot loader package from the GNU Project. GRUB is the reference implementation of the Multiboot Specification, which allows a user to have several different operating systems on their computer at once, and to choose which one to run when the computer starts.
You can overwrite MBR with standard dd command. You can also use old good MS-DOS fdisk command to overwrite MBR.
Using MS-DOS/Windows 9x boot disk
In order to remove the GRUB bootloader from a Linux and Windows XP machine, boot with a Windows 9x startup disk or CD and execute the MS-DOS command:
fdisk /mbr
Using Windows XP boot disk
Boot computer using Windows XP (Windows 2000) setup disc / CD / DVD. Next, type the following commands:
# fixmbr
# exit
Using Linux
You can also use dd command from Linux itself (it removes partition table):
# dd if=/dev/null of=/dev/sdX bs=512 count=1
Just remove MBR, without the partition table (see comment below):
# dd if=/dev/null of=/dev/sdX bs=446 count=1
Replace /dev/hdX with your actual device name such as /dev/hda. Use fdisk -l command to find out device name:
# fdisk -lOutput:
Disk /dev/sda: 251.0 GB, 251000193024 bytes 255 heads, 63 sectors/track, 30515 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 30384 243955057+ 83 Linux /dev/sda3 30385 30515 1052257+ 82 Linux swap
- Email FAQ to a friend
- Printable version
- Rss Feed
- Last Updated: 12-7-07

{ 39 comments… read them below or add one }
The command # dd if=/dev/null of=/dev/sdX bs=512 count=1 is correct, but this will also wipe the partition table(!).
It could use a note that this will get you in troubles if you want to be able to reuse your data.
the alternative to NOT wipe the partition table is with bs=446 (NOT 466)
Have a good one,
Martijn,
You are correct; I have updated the article.
Appreciate your post.
Thanks for the help very easy to follow
How do you do it in Vista? I was attempting to install a Linux on an external HD, but apparently the idiotic installer decided GRUB was better off being the only thing to end up the internal drive. This is on a laptop with Vista preinstalled.
For Vista,Try this:
http://www.sysint.no/Nedlasting/MbrFix.htm
On Fedora Core 6, I had to use /dev/zero instead of /dev/null. Otherwise, this guide worked great. Thanks.
i suggest you download the latest version of hiren’s boot cd and use one of the mbr tools to install standard boot code – worked for me
Hi!
You can do it under linx:
0. log in as a root
1. install lilo (if you do not have)
2. create a dummy lilo.conf
like this:
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
default=dos
other=/dev/hda1
label=dos
install lilo to MBR
lilo -M /dev/sda -b /dev/shd
and uninstall
lilo -U -M /dev/sda /b /dev/sda
Regards
Gergo
This only works for XP if you have the administrator password. The way to get around the password is to use the registry editor and go to HKEY_LOCAL_MACHINE, SOFTWARE, Microsoft, Windows NT, Setup and then Recovery Console. Once you get to the Recovery Console part you must change the Security Level and Security Command value’s to 1. You can do this by right clicking and the click modify and then change the values to 1. Then you can reboot to the Recovery Console and the CD and then you can do the FIXMBR command which will fix your MBR…
Thanks, great article – removed that pesky GRUB from my drive which decided to boot before my primary one does
Hi:
I am trying to get rid of this GRUB and Linux partitions but i have windows vista and i cannot enter to that recovery console with the installation disk. Any suggestion?
Hi, I’m having exactly the same problem in trying to remove GRUB. I have an older dual-boot system (XP Pro SP/2 and Ubuntu) and I’m using one of the slave drives from that old system as a primary drive in a new system that I’m building. I installed the drive into the new system and attempted performing a fresh install using XP Pro to delete old repartitions, create a new one, and reformat the entire drive, without considering that I needed to remove the existing GRUB mbr prior to performing the install. So even though XP Pro will perform the entire install without no errors, I still get a GRUB load error on reboot.
I’ve tried using the recommended XP Pro Recovery Console process of running “FIXBOOT C:” then “FIXMBR” and then “BOOTCFG /rebuild” as well as various other alternatives and nothing works – not even deleting the partition and reformatting!
Help!
You need to use /dev/zero, not /dev/null.
Guys if you have problems with grub in Windows Vista
this is how you solve it. restore your MBR before u erase the linux partition .
(Master Boot Record)= MBR
Put the Windows Vista installation disc in the disc drive, and then start the computer.
2. Press a key when you are prompted.
3. Select a language, a time, a currency, a keyboard or an input method, and then click Next.
4. Click Repair your computer.
5. Click the operating system that you want to repair, and then click Next.
6. In the System Recovery Options dialog box, click Command Prompt.
7. Type Bootrec.exe /FixMbr, and then press ENTER.
That’s it. Now when you reboot your PC, Vista will load automatically… You can now safely boot using your Ubuntu desktop CD, to use the built in Gnome Partition Manager to remove your Ubuntu partition!
Rodney try to get any Vista instalation just to get in comand prompt and problem solved. Or get a dos boot floppy, USB, or burnt CD. Get to c: and type Bootrec.exe /FixMbr, and then press ENTER.
Done. Always enter bios setup to boot from the device to get to comand prompt ex: (USB, CD, Floppy etc.)
Remember to backup all your data before u install any other operating system.
That way your on the safe side always.
A problem and a few questions.
Problem:
Older computer was running Fedora C4 great for several months installed from a Corporate DVD that I got from work.
Decided to install Fedora 9. Downloaded it and ultimately made 3 copies due to unsuccessful installs.
First:
Initial attempt wiped the drive and pooped the bed half way through the install. The system would not boot anything (no other media, cd, dvd, usb) until I removed the hard drive from the system, set it as slave in my XP box, formatted the drive, and set it back into the fedora box.
Next:
Fedora 9 installed with no errors, looking good so far. Reboot, and all I get is grub (I did not install this with the F9 but I did with the F4 I haven’t played with Linux since RedHat5.2).
Then:
Read this string as I was thinking that I don’t need grub if the system is only running one OS anyway. Removed grub using the
dd if=/dev/zero of=/dev/sdX bs=446 count=1
(null didn’t work)
Now:
When I boot the system stops at
Verifying DMI Pool Data ……….
I am guessing that I can fix the MBR using the F9 dvd in rescue mode but I don’t know how.
Q1: Can I fix this from the Fedora dvd in rescue mode?
Q2: If so, how do I go about that?
Q3: Since I have 1 hard drive and one OS, do I need grub?
Please don’t assume that I know anything, I hate the standard 3 hour search because I am supposed to know where the command/file is located that I don’t know to begin with.
Thank You for Your Time and Concern,
Papasmurfcba
I was having Windows XP and Ubuntu before i went on to install Solaris. I made a mistake of not knowing that Solaris shared the same ’swap’ order as that of UBUNTU. So, after the installation, i got two OS’s in the system (Solaris and Windows), instead of 3 (i wanted XP, Solaris and UBUNTU together) and the GRUB menu got updated to 2.0. The Linux partition dissappeared from the menu.
Now i just want to get rid off these Solaris and UBUNTU installations by keeping my XP intact.
I tried the “fixmbr” technique, but i still get to the Solaris GRUB menu.
So, inorder to directly boot to XP, should i remove (delete) the Ubuntu and Solaris partitions on the harddisk?
When i tried to remove Solaris, i get an “operating system not found error”. So inorder to get to XP, i need the GRUB menu.
i want it to be plain old XP…(direct boot)
hope u guys can help me out here…
Oh my god! I ran following on my dual (XP & Fedora 9) after booting from Fedora(linux) and now my system doesn’t boot at all! Not even from XP!! Just shows blank screen (with blinking underscore)!
# dd if=/dev/zero of=/dev/sdX bs=446 count=1
Is it expected ? Please help…
If I run fixmbr now, I think that will destroy all my partition table??
Looks like running “fixmbr” fixed the booting issue.
Cheers
Hi, Well I got this issue with Grub 0.91 and Damn Small Linux 4.2.4. I have Vista Home Premium, and I run the Live cd of DSL, and there I connected my USB drive and I “Installed it on there”Now I have 2 partitions that I don’t know where did they came from and My OS Vista doesn’t load after doinf some of the thisngs you guys said about fixmrb and stuff. It says Error Running the Os. Now I dont know what happened to all my info and I dont know what this 2 partitions do and I dont know what to do… If needed I will give more details…Thnx
thankyou guys absolutely brilliant advise i managed to fix in literally 30seconds with your advise
Great little article. I have been looking for a simple method to safely remove Ubuntu while keeping my XP install since I completely fluffed up Ubuntu by following an incorrect guide elsewhere for something completely unrelated.
Anyway, I will give this a go.
Thank you
I had the same problem as Diesel, and this saved my XP install. Thanks for the information!
I have exactly the same problem with Derfomiundz . I tried to install DSL-n in the USB stick and had confirmed that I can see the contends in it when mount as “sda1″. But later I found out that the hard disk is also using “sda1″ and it overwrite my boot sector er installation and I can’t boot up my windows XP anymore. Any help will be appreciated as all my data for work in my hard disk is not backup. Any advise to make my Dell Laptop bootup again in Windows XP is very much appreciated.
xp + fc6
didn’t work with fixboot c: or fixboot [c:], BUT “fixboot” (without parameters) wrote a warning, and then wrote proper boot record. Hope this helps.
Regards,
camypaj
@Velibor (7 months later!)
Thank you! I had installed Ubuntu on an external USB drive, and did not realize grub would be installed on my boot hd. Grub is fine, but if I tried to boot my laptop without the external HD connected (even though I only wanted to boot into Windows), I’d get “Grub error 20″ (unspecified error).
Hi ppl,
I have Fedora 8 and Win XP SP2 installed… I have a problem in Win XPthrough GRUB. Everytime I try to boot WinXP it says “GRUB Read error” after showing the menu consisting of the different OS. I tried to uninstall GRUB using the “dd” command as mentioned in this discussion and my MBR was changed. Now, when I try to boot WinXP I am facing a black screen with “GRUB” at the top left corner of the screen. I am unable to boot any OS now. Initially I had WinXP as my primary boot. I went through this forum and couldn’t find a solution to my problem. I will be glad if I am able to boot WinXP for now so that I can go to disk management and then try to install linux after that…
Need your help people!
Thank you
Hi – I wanted to try Ubuntu, but couldn’t get my head around it and now I have a dual-boot screen that I don’t know how to remove! I also no longer have my Vista recovery CD so the above, really straightforward methods, won’t work – which is what you get for packing in a hurry when you’re drunk and moving flats…..is there any way I can do this? Help really appreciated!
I dont have a CD drive in my laptop and I wanted to fix the issue. I cannot use the Recovery method (obviously since I dont have a CD drive). Is there another way to re-write the windows boot record?
listen to this man cos his solution realy works
thxxxxxxxxxxxxxx
gbacskai 09.11.07 at 9:16 pm
Hi!
You can do it under linx:
0. log in as a root
1. install lilo (if you do not have)
2. create a dummy lilo.conf
like this:
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
default=dos
other=/dev/hda1
label=dos
install lilo to MBR
lilo -M /dev/sda -b /dev/shd
and uninstall
lilo -U -M /dev/sda /b /dev/sda
Regards
Gergo
Thank u very much
I suppose FIXMBR only works if your windows partition was on the _FIRST_ partition of the drive..
i am in big trouble , i removed my xp and installed ubuntu 7.10 but i realised dat i did blunder, when i wanted to install xp again… i booted from cd.. then a black screen comes with setup is inspecting your computer hardware config and screen disappears and nothing happens…. my exams are on my head pls anyone reply fast.. i will be very greatful of urs…thanks in advance..pls reply soon
pls reply soon.. as soon aS possible
gbacskai,
Your information worked awesome for me — thanks muchly.
I had a broken grub boot loader after removing the linux partition from my dual boot EEE PC, and now it’s working again.
Thank you very much for the tip on how to remove grub.
Back to windows XP,
sorry to say but Ubuntu was a very bad experience for me.
In order for it to move I had to constantly move the mouse. I am using an ACER 430 travelmate.
Kind regards
Francis
I don’t have a setup disk, so I’ve tried the dd approach, which certainly seems to have removed grub, I no longer get an error at start up, but neither does the XP system load. How do I rebuild the MBR now that it has been over-written, so that XP can load? I have a current backup, so I would be happy completely formatting the disk or anything else destructive!
Hey, I have read the above tips on removing GRUB in the windows XP and Vista, but I have been unable to remove this successfully. I have duel booted windows Seven RC 32bit with Ubuntu 9.04 (Beta)! Is there anyway I can remove Ubuntu 9.04 and keep Seven? Thanks heaps cheers!
@PapasmurfCBa
I believe the assessment that outputing from /dev/null does not work is correct.
As far as I know, this is not limited to Fedora, but all Linux and UNIX-like sytems! It must be:
#dd if=/dev/zero of=/dev/hd## bs=446 count=1
To work in general. /dev/null is a place to send useless outputs, instead of to stout, for example. However, /dev/null will never contain anything, and so it cannot be used as an input file for any purpose, including dd. /dev/zero contains blank information, so it can be used as an input file to clear any sort of files or storage media location.
Unless I am in serious error, I request that the original post be edited to this point. If systems exist that can use /dev/null as an input file, then the post should, at the very least, be edited to specify that the commnad, as written, has limited usage, and that using if=/dev/zero is a more universally applicable technique.
I appreciate the post, though, and particularly the bs=446, which I always forget the exact value of.
A linked post on how to re-enable grub may also be useful. It’s pretty straight forward, but usually when I disable booting, it is for particular problem solving, and then I need to reenable grub later. I could post with the ~10 commands for this purpose from a Live CD if it’s useful.