This is the personal website of John Watson: father, software developer, artist, guitar player. Follow me on Mastodon or Twitter or Twitch or itch.io or GitHub.

Removing Windows from a Dual-Boot System

I’ll try to keep this brief but I wanted to post it because I couldn’t find exactly this procedure anywhere online. Here’s my situation: when I installed Ubuntu I didn’t just repartition my Windows drive—I added a whole new hard drive for it. So I ended up with Windows XP on /dev/sda1 and Ubuntu on /dev/sdb1. So, with that setup how do you remove the Windows drive without rendering the system unbootable?

My goals were to remove Windows and re-dedicate the drive as backup storage. There are easier ways to do this. For example, I could have simply deleted all of the files on the Windows drive and been done.

But because I’m human and often irrational and for aesthetic and symbolic reasons, I wanted the Windows drive to become /dev/sdb1 and I wanted to reformat it for the ext3 file system. So, here’s what I did:

[ Follow this procedure at your own risk! If you come whining to me that you blew up your computer I will feel your pain, shake my head sadly, send you some good vibes and not write you back. ]

  1. Download Ubuntu and create a bootable live CD. This will be your rescue tool if you screw up. You may also want to create a backup of your important files, just in case.
  2. Reboot into the Live CD.
  3. Open a console and start GRUB:

    $ sudo grub

  4. Find your Linux drive (the result shown here says Linux is on device hd2):

    grub> find /boot/grub/stage1 (hd2, 0)

  5. Install GRUB into the MBR of the Linux drive:

    grub> root(hd2, 0) grub> setup(hd2)

  6. Since I was changing the physical order of my drives, I edited /boot/grub/menu.lst and changed all references to the old drive (hd1) to the new one (hd0).
  7. I also deleted the Windows boot entries in menu.lst.
  8. I don't know if this is strictly necessary, but I used gparted to add the "boot" flag to the Linux drive's root partition.
  9. Then I powered down and physically switched drive channels so that the Ubuntu drive would be hd0.
  10. Then I rebooted. It worked. :-)

There are a lot of ways you can mess this up, but as long as you don’t reformat or delete anything, even if you can’t boot, all of your data and files are still there. With the live CD handy you can still get on the internet and find help and get at all of the files on your drives if necessary.

Read the GRUB manual. Make sure you check your BIOS and it is using the correct hard drive for booting. Also, if GRUB loads but can’t boot your system, you can get into a console and/or edit menu entries on the fly from there which will allow you to try different device numbers until you find one that works (and when it does, write it down and edit your menu.lst appropriately).