Ubuntu can be removed by wiping the disk it occupies, reinstalling Windows or macOS, or shrinking the partition if Ubuntu shares space with another operating system

The method depends on whether Ubuntu is your only operating system, whether it shares a disk with Windows or macOS, and whether you want to keep the other system. If Ubuntu is alone on the machine, the fastest route is to boot from a Windows or macOS installation disk and write over the entire drive. If Ubuntu shares the disk with another OS, you can delete just the Ubuntu partition and reclaim that space. The steps differ significantly between these scenarios, and choosing the wrong one can accidentally erase data you meant to keep.

Key Takeaways

  • If Ubuntu is your only operating system, you will need a Windows or macOS installation disk to overwrite the entire drive.
  • If Ubuntu shares a disk with Windows or macOS, you can delete only the Ubuntu partition using the other system's disk management tool without touching the rest of the drive.
  • Back up any files stored on the Ubuntu partition before you begin, because deletion is permanent.
  • The process takes 15 minutes to an hour depending on disk size and your method, and your computer will be unusable during the overwrite.

Ubuntu is your only operating system

If Ubuntu is the only OS on your machine, you will need an installation disk or USB drive for Windows or macOS to replace it. You cannot delete Ubuntu and then have a working computer — you need something to install in its place.

First, obtain installation media. For Windows, read the Windows installation tool from Microsoft's website on another computer, and write it to a USB drive using the Media Creation Tool. For macOS, use another Mac to create a bootable USB drive from the macOS installer in the App Store. You will need a USB drive with at least 8 GB of free space.

Insert the USB drive into your Ubuntu machine, restart it, and hold down the key that opens the boot menu — usually F12, Esc, or Del, depending on your computer's manufacturer. Select the USB drive from the menu. The Windows or macOS installer will start. Follow the prompts to install the new operating system, and when asked where to install, select the entire disk. This will overwrite Ubuntu completely. The installation process takes 20 to 45 minutes depending on your disk speed.

Ubuntu shares a disk with Windows or macOS

If you have both Ubuntu and Windows or macOS on the same drive, you can delete only the Ubuntu partition and leave the other system untouched. This is safer than overwriting the entire disk because you keep your existing Windows or macOS installation and all the files stored there.

Boot into Windows or macOS, not Ubuntu. On Windows, open Disk Management by right-clicking the Start menu and selecting "Disk Management". On macOS, open Disk Utility from Applications > Utilities. Look for the partition labeled with Ubuntu's name or the Linux file system type (ext4 or similar). Right-click it and select "Delete Volume" on Windows or "Erase" on macOS. Confirm the deletion. The space will become unallocated, and you can leave it empty or use it to expand your Windows or macOS partition.

After deletion, you should also remove Ubuntu from the boot menu so your computer does not try to load it on startup. On Windows, open Command Prompt as administrator and run bcdedit /enum firmware to list boot entries, then bcdedit /delete {GUID} to remove the Ubuntu entry. On macOS, restart while holding Command + R to enter Recovery Mode, open Startup Disk in System Preferences, and select your macOS partition as the default boot drive.

Back up your files before you start

Any files stored on the Ubuntu partition will be permanently deleted and cannot be recovered once the partition is erased. If you have documents, photos, or other data on Ubuntu that you want to keep, copy them to an external drive or cloud storage before you begin the deletion process.

The easiest way is to plug in an external USB drive, open the file manager in Ubuntu, and drag your files to the external drive. If you have a lot of data, this may take several minutes. Once the transfer is complete, safely eject the external drive and verify that the files are readable on another computer before you proceed with deletion.

Removing Ubuntu from a dual-boot setup without losing Windows or macOS

Dual-boot systems — where Ubuntu and Windows or macOS coexist — require careful deletion to avoid accidentally removing the other operating system. The safest approach is to delete the Ubuntu partition from within Windows or macOS, not from Ubuntu itself.

On Windows, Disk Management shows each partition as a separate box. Ubuntu partitions are usually labeled with Linux file system names like ext4 or swap. Right-click the Ubuntu partition and select "Delete Volume". Windows will ask you to confirm; click Yes. Do the same for any other Ubuntu-related partitions (there may be more than one). After deletion, the space shows as "Unallocated".

On macOS, Disk Utility shows partitions in a list on the left side. Select the Ubuntu partition and click the minus button at the bottom. macOS will ask you to confirm; click Erase. After deletion, the space becomes part of the free space on your drive.

Fixing the boot menu after Ubuntu is deleted

After you delete the Ubuntu partition, your computer may still try to boot into Ubuntu on startup, which will fail because the partition no longer exists. You need to tell your computer to boot from Windows or macOS instead.

On Windows, open Command Prompt as administrator. Type bcdedit /enum firmware and press Enter. This shows all boot entries. Look for one labeled Ubuntu or Linux. Note the long string in curly braces next to it — that is the GUID. Type bcdedit /delete {GUID}, replacing GUID with the actual string, and press Enter. Restart your computer. Windows should now boot automatically.

On macOS, restart while holding Command + R to enter Recovery Mode. Click System Preferences in the menu bar, then Startup Disk. Select your macOS partition and click Restart. Your Mac will now boot into macOS by default.

What to do if something goes wrong

If your computer will not boot after you delete Ubuntu, or if you accidentally deleted the wrong partition, you can usually recover by booting from a Windows or macOS installation disk and using the repair or recovery tools. For Windows, boot from the installation USB, click "Repair your computer", and select "Troubleshoot" > "Startup Repair". For macOS, restart while holding Command + R and use Disk Utility to check the drive for errors.

If you deleted a partition by mistake and need to recover the files, stop using the computer when ready — every write to the disk makes recovery less likely. You can use data recovery software on another computer to scan the drive, though recovery is not may provide. The longer you wait, the lower the chance of success.

Frequently Asked Questions

Will deleting Ubuntu affect my Windows or macOS files?

No, as long as you delete only the Ubuntu partition. Windows and macOS partitions are separate, and deleting one does not touch the other. Use Disk Management on Windows or Disk Utility on macOS to confirm you are deleting the correct partition before you proceed.

Do I need a product key to reinstall Windows after removing Ubuntu?

If Windows was pre-installed on your machine, the product key is usually stored in the firmware and will set up automatically during reinstallation. If you purchased Windows separately, you will need the product key. macOS does be reinstalled for free on any Mac that previously ran it.

Can I delete Ubuntu without installing something else?

Not if Ubuntu is your only operating system — you need an operating system to use the computer. If Ubuntu shares the disk with Windows or macOS, you can delete the Ubuntu partition and leave the space empty, and your computer will still boot into the remaining OS.

How long does it take to delete Ubuntu and install a new operating system?

Deleting the partition takes a few seconds. Installing a new operating system takes 20 to 45 minutes depending on your disk speed and internet connection. The entire process from start to finish usually takes less than an hour.

What if I want to keep Ubuntu but just remove it from the boot menu?

You can hide Ubuntu from the boot menu without deleting it by removing the boot entry in Windows or macOS. On Windows, use bcdedit /delete {GUID} as described above. On macOS, use Startup Disk in Recovery Mode. Ubuntu will still be on the disk but will not appear as a boot option.