Linux – How to manually delete the Ubuntu partition

linuxmulti-bootpartitioningwindows

Can anyone tell me how to delete Ubuntu from a Linux / Windows dual boot system without harming Windows?

I ran sudo fdisk /dev/sda in a linux terminal and got the following output:

  • /dev/sda1 – system
  • /dev/sda2 – Compaq diagnostics
  • /dev/sda3 – HPFS/NTFS/exFAT
  • /dev/sda5 – W95 Ext'd (LBA)
  • /dev/sda6 – Linux
  • /dev/sda7 – Linux swap / solaris

From my online searches, I know how to delete any of these partitions but what I don't know is if I should delete any of the other non-linux labeled partitions to complete the process.

Best Answer

When in doubt, leave it alone. To remove Linux, delete the partitions sda6 (Linux) and sda7 (Linux swap). Do not touch the others. While you're at it, make sure that the Windows partition (sda3) is marked as bootable.

This will not give any space back to Windows. If you want Windows to expand, you'll have to do it with Windows tools.

If your system is currently configured with dual boot, it's probably using a Linux bootloader. If you remove Linux, your system will become unbootable. You can try restoring the Windows boot sector by installing the mbr package and running install-mbr:

install-mbr /dev/sda

I don't guarantee that this will work. Your best bet is really to use a Windows installation CD.

Related Question