How To Remove Ubuntu From A Computer Dual Booting With Windows 10 (UEFI only)


If you have installed Ubuntu alongside Windows 10 and you want to remove it so that Windows 10 is left on its own again follow these steps.
These steps only work for computers where Windows 10 and Ubuntu have been installed on a computer with a UEFI bootloader.
A separate guide will be created for computers with a standard bios.
The steps required for getting Windows back to normal are as follows:

  • Change the boot order
  • Delete Ubuntu From The UEFI boot menu
  • Remove Ubuntu Folder From EFI partition
  • Delete the Ubuntu partition
  • Expand Windows 10 into free space

Change The Boot Order

Boot into Ubuntu and open a terminal window (either press CTRL, ALT and T at the same time or press the super key and type term until an icon appears and click on it).
Within the terminal window type the following:

sudo efibootmgr

This will show you the current boot order and in theory Ubuntu will be first and Windows second.
My boot order has a few extra ones because I have been a little bit untidy and not deleted old entries. As you can see though it starts at 0004 which is ubuntu and then goes to 0001 which is Windows, 0000 which in theory is Fedora, 0008 which is CentOS, 0005 which is another ubuntu, 0006 which is yet another ubuntu, finally finishing with 2001 which is a USB drive.
Now I don't really have loads of Ubuntus, Fedora and CentOS installed. These are old entries. The important bits are 0004 which really is Ubuntu and 0001 which is Windows.
What you need to do is make Windows the first item in the list again.
Run the following command picking the number which matches Windows Boot Loader:

sudo efibootmgr -0 1

As you can see in my list 0001 is Windows. You can add extra entries if you so wish but this should suffice to make Windows first.
On its own this doesn't delete Ubuntu but it stops it from booting.

Delete Ubuntu From The UEFI Menu

In the previous section you will have noticed from the screenshots that I had a lot of old menu items hanging around.

To delete a menu option you specify the following command:

sudo efibootmgr -b 8 -B

You need to replace the 8 with the number of the menu item you wish to remove. If you look at the image above boot0008 is for CentOS Linux. After running the above command the CentOS has been removed.
The -b switch stands for modify boot number and the -B stands for delete bootnum.
You can specify the same command in the following way:

sudo efibootmgr --bootnum 8 --delete-bootnum

Remove Ubuntu From The EFI Partition

If you don't remove Ubuntu from the EFI partition then it may be added back to the UEFI boot menu when you add other Linux operating systems.
The steps required here are to work out which partition is the EFI partition, mount it, navigate to it and then delete the Ubuntu folder.
To find out which partition is the EFI partition type the following in a terminal window:

sudo fdisk -l

This lists all the partitions on all the disks attached to your computer.

As you can the EFI partition on my disk is /dev/sda1 as the type shows as EFI system.

I therefore need to mount the EFI partition. I can do this by running the following commands:

mkdir EFI
sudo mount /dev/sda1 EFI

With the EFI partition mounted you can navigate to it using the following command:

cd EFI

When I ran the ls command against the EFI partition there was a folder called EFI. So I navigated to the EFI folder using the cd EFI command again and ran the ls command once more.
As you can see I have folders for the following distributions:

  • Apricity
  • centos
  • debian
  • fedora
  • mageia
  • ubuntu

If I now decided to install another Linux distribution my UEFI menu would undoubtedly be rebuilt with all of those options in it. It is just untidy to leave it this way.
To remove each of the folders all I have to do is use the rm command as follows:

sudo rm -R Apricity

In the image above I have removed all of the Linux folders on the computer leaving just the Boot and Microsoft folders.

Delete The Ubuntu Partition

Boot back into Windows 10 and then right click on the start menu

Click on the "Disk Management" option in the menu.

As you can see I have highlighted the partition on my computer that currently still has Ubuntu installed on it.
Make sure you choose the correct partition otherwise you may delete something important.

Right click on the partition and choose "Delete Volume".

A message will appear asking whether you are sure you want to delete the selected partition. Click "Yes".

Expand The Windows Partition

You will now have a large area of unallocated disk space. To make that space available again you can extend the windows partition which in most cases is the C: drive.

Right click on the C: drive and choose "Extend Volume".

A wizard will load. Click "Next" to continue.

The maximum amount of available disk space will be automatically selected. Click "Next" to continue.

A summary will appear. Click "Finish".


Your computer should now be set up as if you had never installed Ubuntu on it in the first place.

One Response

  1. Ian

Leave a Reply