How to remove Ubuntu when dual booting Windows and Ubuntu

Introduction

If you make a mistake when uninstalling Ubuntu, Windows will not start or the process until it starts is troublesome, so A memorandum after working with a firm grasp of how to do it.

environment

-Windows 10 64bit (installed on M.2 SSD, installed first) -Ubuntu 18.04 LTS (installed on HDD, which is a disk different from Windows, and installed later when needed) -BIOS is UEFI -Disk partition is GPT

Things to be careful of

Since the boot loader is different between Windows and Ubuntu, if you delete the Ubuntu partition while leaving it unattended, the boot loader will not work properly and you will end up in an unbootable state at worst. A boot loader is, so to speak, a trigger for booting. When you install Ubuntu, a boot loader called GRUB is installed and enabled. Windows uses Windows Boot Manager as the boot loader. In my case, I installed Ubuntu with Windows installed first and selected the OS to boot from GRUB. Therefore, if you delete Ubuntu and use it with Windows alone, if you just delete the partition of Ubuntu, Ubuntu will be deleted with GRUB information remaining, and GRUB and Windows Boot Manager will be normal. You should never just delete a partition in a dual boot environment, as it will not boot. This is basically the same for dual boot and multi boot.

Remove GRUB boot loader

Delete entry with bcdedit command

First, start the Windows command prompt as an administrator and execute the following command.

C:¥WINDOWS¥system32> bcdedit /enum firmware

Then, boot information will appear, so look for the one that says Ubuntu in the description item. (The following is an example)

Firmware application(101fffff
-------------------------
identifier      {3850e5k3-351b-95c3-806e6f6e6963}
device          partition=¥Device¥HarddiskVolume13
path            ¥EFI¥ubuntu¥SHIMX64.EFI
description     ubuntu

If you find an item that says ubuntu, delete it, but since you need an identifier at that time, copy it including the {} part. At this time, be careful not to copy other identifiers! If you delete the wrong one, you may not be able to start Windows.

Then execute the following command.

C:¥WINDOWS¥system32> bcdedit /delete {The identifier you copied earlier}

Then, Ubuntu can be deleted from the boot menu, so execute the following command again and confirm that Ubuntu has been deleted.

C:¥WINDOWS¥system32> bcdedit /enum firmware

You have now deleted the boot information about Ubuntu. If you restart here, Windows will start directly without moving to the GRUB screen.

Delete Ubuntu EFI partition

The EFI partition is a partition required to start Ubuntu, and the BIOS reads the EFI partition when the PC starts, enabling the reading of OS such as Windows and Ubuntu.

Since the EFI partition cannot be deleted from the disk management screen, delete it using diskpart on the command prompt. First, execute the following command.

C:¥WINDOWS¥system32>diskpart

Then, the place where it was C: \ WINDOWS \ system32 changes to the notation diskpart. Next, execute the following command to assign a drive letter so that you can operate the EFI partition.

DISKPART>list disk
Disk State Size Free Dynamic GPT
------   ------  ------   ------  ------      ------
Disk 0 Online 1863GB 1024KB*
Disk 1 Online 1863GB 1024KB*
Disk 2 Online 3726GB 1205GB*
Disc 3 Online 465GB 46GB*

Select the disk that contains the Ubuntu EFI partition. In my environment, it's on disk 2, so I chose it.

DISKPART>sel disk 3
Disk 3 is selected.

Next, select the partition.

DISKPART> list vol
Volume###  Ltr  Label     Fs    Type      Size      Status      Info
---------  ---  ------   ---    ------    -----     ------     ------
Volume 0 F data NTFS Partition 1074GB Normal
Volume 1 G Volume NTFS Partition 788GB Normal
Volume 2 FAT32 Partition 488MB Normal Hide
Volume 3 FAT32 Partition 99MB Normal system
Omitted below

Ubuntu (GRUB) information remains in the place where Info says system. Select this Vol.

DISKPART> sel vol 3
Volume 3 is selected.

There is an Ubuntu directory in the selected Vol, and I want to delete it, but I can't see the contents as it is, so I assign a drive character.

DISKPART> assign letter=Z:
Diskpart has correctly assigned the drive letter or mount point.

Once this is done, exit from DISKPART once. Next, move to the Z drive and there should be an EFI directory, so if you enter it, there is an Ubuntu directory, so delete it with the following command.

Z:¥EFI>rmdir /S ubuntu

Confirm with yes because you will be asked if you want to delete it. The drive character needs to be deallocated, so do the following:

C:¥WINDOWS¥system32> diskpart

DISKPART> sel vol 3
Volume 3 is selected.

DISKPART> remove letter=Z

In order to delete Ubuntu's EFI partition itself, you need to format the HDD itself or use software to delete it.

This method is used because the BIOS was UEFI in my environment, but it seems that the method is different for the legacy BIOS, so I recommend you to take a look at here.

For the time being, I just described the work process, and I do not understand it deeply, so I think that there are many parts that are misinterpreted. I would appreciate it if you could let me know if you noticed it.

Reference site

How to remove Ubuntu GRUB boot loader on Windows 10 UEFI / Legacy BIOS

Other/Procedure to remove Linux from UEFI boot

Recommended Posts

How to remove Ubuntu when dual booting Windows and Ubuntu
How to log in automatically when Ubuntu restarts
How to use RealSense with ubuntu 20.04 and ROS Noetic
What to do when booting Ubuntu on WSL2 and getting "Process terminated with code 1"
How to add HDD to Ubuntu
How to test including images when using ActiveStorage and Faker
How to write and notes when migrating from VB to JAVA
How to use StringBurrer and Arrays.toString.
How to install and use Composer on an ECS instance on Ubuntu 16.04
How to use EventBus3 and ThreadMode
[Java] How to update Java on Windows
How to install ImageMagick on Windows 10
What to do if Intel RST (Rapid Storage Technology) interferes with dual booting Ubuntu20.04LTS and Windows10
How to call classes and methods
How to use equality and equality (how to use equals)
How to use Bio-Formats on Ubuntu 20.04
How to install and configure the monitoring tool "Graphite" on Ubuntu
How to connect Heroku and Sequel
[jOOQ] How to CASE WHEN in the WHERE / AND / OR clause
How to convert LocalDate and Timestamp
How to install the language used in Ubuntu and how to build the environment
How to install WildFly on Ubuntu 18.04
How to build vim on Ubuntu 20.04
Creating a dual boot environment for Ubuntu Server 20.04.1 LTS and Windows 10
How to distinguish ubuntu cloud image
Solution when dual booting two Ubuntu and then unbooting the SSD with one Ubuntu installed and it doesn't boot
[Android] How to pass images and receive callbacks when sharing using ShareCompat
What to do and how to install when an error occurs in DXRuby 1.4.7
How to use OrientJS and OrientDB together
How to install production Metabase on Ubuntu
IP address and port restrictions to Ubuntu
[Java] How to output and write files!
How to resolve errors when installing Rails 5.1.3
How to set up and use kapt
How to remove Alfresco CE tracking tags
How to change the timezone on Ubuntu
[Rails] [Memo] When to add = to <%%> and when not
How to find the tens and ones
[Easy] How to upgrade Ruby and bundler
How to use substring and substr methods
Note: [Docker] How to start and stop
How to write and explain Dockerfile, docker-compose
How to use @Builder and @NoArgsConstructor together
RDP connection from Windows 10 to Ubuntu Desktop 20.04
Check when created_at, datetime, etc. are not saved in Japan time in Docker and Rails
A memorandum when CentOS is installed in VirtualBox and basic settings are made [macOS]
How to remove Ubuntu when dual booting Windows and Ubuntu
How to display today's date and time by default: Remove seconds or less
How to share on the host side (windows) and guest side (CentOS 7) with VirtualBox
[Ruby] How to convert from lowercase to uppercase and from uppercase to lowercase
How to output Excel and PDF using Excella
[Java] How to use FileReader class and BufferedReader class
(Memo) How to solve dummy output in Ubuntu 20.04
[Rails] How to write when making a subquery
How to configure ubuntu to be used on GCP
How to add / remove Ruby on Rails columns
[Java] How to get and output standard input
How to install network drivers on standalone Ubuntu
[Ruby] How to use gsub method and sub method
How to play audio and music using javascript
How to install NVIDIA driver on Ubuntu 18.04 (Note)
How to delete the database when recreating the application
Git and GitHub ~ How to fix common errors ~