How do I remove Windows after installing Ubuntu?

15,826

GRUB is not showing a Windows partition; it's showing a Windows boot loader file. This is an important distinction because your misunderstanding is sending you on a wild goose chase. (It sounds like you haven't been chasing those geese for very far, though.)

On an EFI-based computer like yours, boot loaders are stored as ordinary files in the EFI System Partition (ESP), which in Ubuntu is mounted at /boot/efi by default. Given that, your Windows boot loader files are stored in the /boot/efi/EFI/Microsoft directory tree, as viewed from Ubuntu. Deleting that directory tree will delete the Windows boot loader. Be careful, though! If you accidentally delete too much (like the entire /boot/efi/EFI directory tree), you could delete the Ubuntu boot loader, too!

Because GRUB relies on a configuration file that's created within Ubuntu to display its boot menu, deleting the Windows boot loader will not cause the Windows entry to be deleted immediately. To do that, you must type sudo update-grub, which rebuilds the configuration file.

Note also that most EFI-based computers maintain a list of boot loaders that will be shown in the computer's own boot manager. (You may have used this boot manager to launch the Ubuntu installer on CD-R or USB flash drive.) To delete this entry, you can use efibootmgr:

  1. Type sudo efibootmgr to see a list of what's available. (For more detail, type sudo efibootmgr -v; but you probably don't need this extra detail for this task.)
  2. Identify the Windows boot manager in the list. (It's called exactly that.) Note its number (Boot0003, for instance.)
  3. Delete the Windows boot manager entry with efibootmgr's -b #### and -B options, as in sudo efibootmgr -b 0003 -B to delete Boot0003.

Note that deleting the NVRAM's own boot entry is not required to remove the entry from GRUB. Also, some computers will delete this entry automatically when you reboot and the computer discovers that the entry is no longer valid because the program it references is missing. I note this procedure in the interest of completeness for those who want to do an extra-thorough job of removing references to Windows from the computer.

As a side note, I strongly recommend you back up your ESP -- perhaps both before and after deleting the Windows boot loader. This will protect you against accidental damage to it. A file-level backup (using cp, tar, zip, or similar file-level tools) should be sufficient. If the ESP becomes damaged or you accidentally trash it, you can restore the backup with an emergency disk and minimal fuss.

Share:
15,826

Related videos on Youtube

ba11b0y
Author by

ba11b0y

Updated on September 18, 2022

Comments

  • ba11b0y
    ba11b0y almost 2 years

    I installed Ubuntu Gnome 16.04 LTS and deleted my existing partitions in Windows to free space . Now although I can boot into Ubuntu but also it shows up in my partitions that my Windows still exists. How do I remove it and allocate all of that unallocated space to Ubuntu.

    This is a screenshot of my current partitions from Gparted:

    Image