How to Get Rid of a Linux Dualboot Setup with Windows [UEFI]
Table of Contents
Ok. No fluff. Since you are here, I assume you installed a Linux distro to dualboot with Windows and now want to get rid of it.
Steps⌗
All the steps mentioned here are to be followed in Windows and are same for almost every Linux distro that uses GRUB
as its bootloader.
Ensure UEFI mode⌗
Before starting though, let’s just make sure your machine is indeed UEFI based.
- Open Run dialog — Press
Win+R
keys - Type
msinfo32
and hitEnter
- In the opened window, scroll until you see
BIOS Mode
. It should sayUEFI
.
Remove Bootloader/GRUB⌗
- Open 2 Powershell windows as Administrator
- Open Run dialog —
Win+R
- Type
powershell
- Press
Ctrl+Shift+Enter
- Confirm privilege escalation
- Open Run dialog —
- In the first window, launch
diskpart
- List all the disks connected to your machine with
list disk
- Select the disk where both your operating systems are installed along with the EFI partition, with
select disk <num>
where<num>
is the number of the disk determined from the previous step - List the partitions on the disk with
list partition
- Select the EFI/System partition with
select partition <num>
- Mount the partition with
assign letter=x
and switch to the otherpowershell
window- Use another mount point if
x
is already in use for a drive
- Use another mount point if
- Now, change the working directory with
cd X:\
- List the directory contents with
ls
ordir
- Find a folder with a name related to your distro/GRUB.
- It might be in one of the sub-directories such as
EFI
, e.g. for Fedora, it isX:\EFI\fedora
- It might be in one of the sub-directories such as
- Delete the folder with
rd <dirname>
where<dirname>
is the name of your folder and close the window - In the the other one, unmount the
EFI
partition withremove letter=x
or use whatever mount point you set.
Reclaim Linux’s Partitions⌗
- Open
diskmgmt.msc
with Run Dialog - Delete the partitions you created for dual boot or the ones that were automatically created by your distro
- These are generally without labels and unrecognized by Windows
- Merge back the freed unallocated space or create a new partition by right clicking it
With that, we have successfully removed the Linux installation. But, not all traces of it.
Remove Boot Menu Entry⌗
- Launch
powershell
as Administrator once again - List all the boot menu entries with:
1
bcdedit /enum firmware
- Find the deleted OS’ entry and copy its identifier. It should be a radom string enclosed in curly braces
- Export the bcd store with:
1
bcdedit /export newbcd
- Create a copy just for backup with:
1
cp newbcd bcdbackup
- Edit the exported bcd store and remove the unneccessary entry with:
1
bcdedit /store newbcd /delete <identifier>
<identifier>
is the identifier you copied earlier
- Import the
newbcd
back with:1
bcdedit /import newbcd /clean
And, with that your machine no longer has any traces of dual-booting.
This is a one-stop resource that I wish I had the first time I dual booted. Other guides leave out the boot-menu part or some other random detail.
Read other posts