Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have setup a dual boot system in my home computer with XP and Ubuntu in that order. I want to know how to remove the linux partition without screwing up the bootloader?

I want to know this because I had this kind of setup before and to remove the linux partition I had formatted the linux partition from Windows (Disk Manager) and was not able to boot back into XP, since the MBR was screwed up. I had to use an XP install CD to fix the MBR and etc. I know what I have done was stupid and I am eager to learn the correct way.

share|improve this question
    
Did you want to keep GRUB as your bootloader for XP or are you essentially asking how you can whack Ubuntu completely so your only running XP? –  Justin Andrusk Sep 10 '11 at 1:29
    
I will need to only run XP for the time being. So only XP. –  Nanda Sep 10 '11 at 1:48
add comment

1 Answer 1

up vote 3 down vote accepted

Using the install CD to issue a fixboot and a fixmbr from recovery mode is a correct method. It is just the last part of removing anything related to a dual boot when a bootloader (grub) was installed in a partition boot sector. It is not wrong or stupid to do this from within Windows.

Nevertheless... you can also do this from within Ubuntu before removing the partition. You can use

 sudo fdisk -l

to find out your disc lay-out. Example:

Device     Boot    Start       End    Blocks   Id  System
/dev/sda1   *       2048  19531775   9764864   83  Linux
/dev/sda2       19533822 234440703 107453441    5  Extended
/dev/sda5       19533824  39063551   9764864   82  Linux swap / Solaris
/dev/sda6       39065600 234440703  97687552   83  Linux

The one with the * underneath boot holds grub (technically it could be any bootmanager). In the commands below you need to change sda to your device (mostlikely it will be sdb if you have a dual boot). In this case a...

dd if=/dev/null of=/dev/sda bs=446 count=1

removes grub. And to remove the partition table along with grub you could also do a

 dd if=/dev/null of=/dev/sda bs=512 count=1

I have seen people claim /dev/null should be /dev/zero but you understand that I am not going to issue these commands on my system ;-)

If you are unsure of any of these commands (I hardly expect a new user to understand these) the most logical method to me would be to use Windows recovery mode.

And to back this up with some examples: http://linux.koolsolutions.com/ has 3 methods to remove grub. First 2 methods take the Windows approach and the third uses dd.www.cyberciti.biz has 2 methods. First one is the Windows method and the second one uses dd.

So assuming that when explaining something where there are more than 1 ways you would start with the easiest/best method I would claim most will use Windows recovery. And it is definitely not stupid but very smart to stick with commands you know. It is stupid to use commands you are hardly familiar with.

share|improve this answer
    
Rinzwind, thank you for taking time to post such a complete answer. It is good to hear that my method is indeed one of the ways to go to achieve what I want. –  Nanda Sep 10 '11 at 1:55
1  
What else can I do at 4 am when I can not get to sleep than answer your question ;-) –  Rinzwind Sep 10 '11 at 2:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.