66

I want to keep Ubuntu but remove Windows.

7
  • 8
    Give us more details about your setup. Are you using Wubi, Partitions, or haven't even started yet? Commented Aug 4, 2010 at 12:18
  • Also, which version of Ubuntu (and GRUB) are you using? Commented Aug 4, 2010 at 14:12
  • 6
    @Anwar This is frequently used as a canonical question, for closing other questions as duplicates. I think it would not benefit from being more specific; its value lies in its generality. Commented Oct 4, 2012 at 8:44
  • 2
    If you have good backups, particularly /home & list of installed apps then you can easily reinstall and repartition how you like. Alternatively you can just delete the NTFS partitions & move /home into a new ext4 partition where the NTFS was. Do not erase the ESP- efi system partition which is FAT32. Commented May 30, 2023 at 16:10
  • Thanks old friend, the Lenovo although about 7 years old was just taken out of the box. The win 10 is a nightmare I’ve done all the updates and maintenance chores but it just ain’t working right and takes 10 minutes to boot up. So if do a new install without the dual boot I haven’t lost anything. Your alternative is way over my head. Thank you for your help. Commented May 30, 2023 at 19:04

6 Answers 6

58

Assuming you have installed Ubuntu on a separate partition, all you have to do is remove your Windows partition and remove the Windows option from your GRUB boot menu.

  1. Make sure your backups of your documents (and other important files, such as ebooks, videos, music, and so forth) are current. If you are going to expand the Ubuntu partition to take up the space freed by removing your Windows partition, then this is especially important, as there is always some risk (though small) of data loss when performing dynamic partition resizing. However, even if you are not planning to do this, unless you are highly experienced with repartitioning, there is a significant risk that you may make a mistake (you probably will not, but if you do, you want the consequences to be minimally bad).

  2. Boot from an Ubuntu live CD/DVD or live USB flash drive (as it is not considered safe to edit a physical disk's partition table from within any of the operating systems installed on the physical disk). Select Try Ubuntu rather than Install Ubuntu.

  3. Use GParted, the GNOME Partition Editor, to edit the partition table on the hard disk, removing the Windows system.

    • Start GParted (System > Administration > GParted, or if you're using a live system of Ubuntu 11.10 or later, press the Super, i.e., Windows key, type gparted, and click the search result that appears).
    • Select your Windows partition (it will be of type NTFS and will probably have a pale green border).
    • Delete it (Partition > Delete).
    • Optionally, resize your Ubuntu partition to take up the freed space. You may be able to do this by selecting it (it's of type ext4) and using Partition > Resize/Move. However, if it is contained in an extended partition (a kind of container partition for other partitions) and the Windows partition was not contained in the extended partition, then you may need to expand the extended partition first, and then expand the Ubuntu ext4 partition contained within it.

      While this step is optional, the space that Windows occupied will not be available to your Ubuntu system if you skip it. (However, if you just want to use the space for storage, you could create a new partition for that purpose where your Windows partition used to be, instead of expanding Ubuntu's ext4 partition.)
    • Apply your changes (Edit > Apply All Operations).
  4. Quit GParted and reboot (click the power icon at the upper-right corner of the screen and click Restart or Shut Down). Once you have booted back into the Ubuntu system installed on the hard drive, update your GRUB menu to remove the Windows option, by running sudo update-grub in a Terminal window (Ctrl+Alt+T). When you run that command, you might be prompted for your password. As you enter it, you won't see any placeholder characters (like *). That's OK--just type it in and press enter. After you've run that command, Windows should no longer appear as an option to select in the boot menu.

However, unless your Windows partition is seriously damaged or infected with viruses, I wouldn't recommend removing it. Instead, shrink your Windows partition, leaving space for your data plus an extra gigabyte for virtual memory (the versions of GParted that come with all currently supported Ubuntu releases are able to resize NTFS partitions). You never know when you'll need to use an application that only works with Windows.

0
13

Here is a graphical tool to easily remove any OS (Windows, or Ubuntu, or else): OS-Uninstaller

enter image description here

1
2

If you have Installed Ubuntu using WUBI then probably trying to remove windows will remove Ubuntu, as Windows installed Ubuntu into its root directory unless you haven't specified a different directory at the installation time.

2

If you installed Ubuntu in a separate partition you can easily format the drive with Windows. After that remove Windows entry from grub config.

If you use Wubi you can do one of these:

  • Copy you user home folder to save most of settings.
  • Use OneConf from Maverick.

And reinstall Ubuntu after that.

3
  • sorry but oneconf doesn't work quite well yet. Commented Aug 4, 2010 at 18:22
  • Maverick doesn't work well too. ) Commented Aug 4, 2010 at 20:34
  • What about backing up WUBI then writing to partition from live CD? Commented Nov 11, 2012 at 22:18
2

Considering a more modern system which probably comes with LVM and optionally LUKS full disk encryption, you don't actually need to move or resize partitions the old-fashioned way to get rid of Windows. Instead of the destructive process of shifting the start of a partition—which usually requires a Live USB and risky data moving — you can simply initialize the old Windows space as a new Physical Volume (PV) and add it to your existing Volume Group (VG) and extend Logical Volume (LV) to full VG extents, resizing filesystem at the same time. If you are feeling lucky, you can even do that on HostOS without LiveUSB (although in case of boot errors you will need one either way...).

This method allows you to span your Ubuntu installation across two different physical areas of the disk transparently. If you are new to these concepts, it is helpful to review this conceptual guide to LVM on Ubuntu and this specific walkthrough on extending with LVM (ASCIIart explains more than a thousand words here).

I did it yesterday and can confirm that it is working (with some hiccup at point 2 where I forgot to update crypttab, initramfs and grub)

Before proceeding with the commands below, better read the whole answer first.


1. Wipe Windows and Reallocate

While you can do this via CLI, using a tool like GParted or the Disks utility is often easier for visual confirmation.

  • Identify: Run lsblk -f. Look for the ntfs partitions on your NVMe drive. In my case windows partitions were sitting after EFI and before linux boot partition (there were like 3 or 4 partitions for windows — bitlocker partition, some reserved, windows, and some recovery).
  • Wipe & Create: Delete the Windows-related partitions (don't delete efi and boot partitions by accident!)
  • Format: Create a single new partition in that unallocated space (or two, see point 2.b). Set it as "Unformatted" or "Cleared." Note the device path.

Note on Naming: In the commands below, names like p_WINDOWS_SPACE or p_BOOT are placeholders for your actual partition numbers (e.g., /dev/nvme0n1p3). Always use the specific numbers identified on your system via lsblk.


2. Handling Encryption (The Tradeoff) — optional

If your Ubuntu partition is LUKS encrypted and you want the reclaimed space encrypted as well, it requires some extra work. I tried storing a key on main partition for the second one, but storing the key for the new partition inside your Ubuntu /etc/ folder creates a boot-time deadlock (the system needs the second partition to mount the filesystem, but the key is on that filesystem).

Option A: The Dual Passphrase — TESTED

Simplest setup, but you'll type two passwords at boot.

sudo cryptsetup luksFormat /dev/nvme0n1p_WINDOWS_SPACE
sudo cryptsetup luksOpen /dev/nvme0n1p_WINDOWS_SPACE unwindowsed

Note: It is a bit tedious at boot, but I picked it for simplicity (and because I didn't think of Option B, only encountering the deadlock after trying A).

Option B: The Auxiliary Key Partition (Key Keeper) — NOT TESTED

This uses a small separate LUKS partition to hold keys for the others.

  1. Prepare KeyKeeper: You can do that with the Disks GUI program if you select no FS and luks encryption key (I recommand GUI for that). First, create some ~100Mb partition at the beginning of the unallocated space reclaimed from Windows — it will be you keykeeper partition. It's up to you if you do that on the same drive or on a USB to have a "physical key". I don't know the actual needed space, I just eyeballed it

    sudo cryptsetup luksFormat /dev/nvme0n1p_KEYKEEPER
    sudo cryptsetup luksOpen /dev/nvme0n1p_KEYKEEPER keykeeper
    sudo mkfs.ext4 /dev/mapper/keykeeper
    sudo mount /dev/mapper/keykeeper /mnt
    
  2. Generate Keys:

    sudo mkdir /mnt/keys
    sudo dd if=/dev/urandom of=/mnt/keys/ubuntu.key bs=512 count=4
    sudo dd if=/dev/urandom of=/mnt/keys/unwindowsed.key bs=512 count=4
    
  3. Add Keys:

    sudo cryptsetup luksAddKey /dev/nvme0n1p_UBUNTU_ROOT /mnt/keys/ubuntu.key
    sudo cryptsetup luksAddKey /dev/nvme0n1p_WINDOWS_SPACE /mnt/keys/unwindowsed.key
    
  4. Cleanup: sudo umount /mnt (Crucial to unmount this before mounting your OS for chrooting).


3. Extend the LVM

Once the partition is opened as the mapper unwindowsed, you absorb it into your LVM.

  1. Initialize the PV:
    sudo pvcreate /dev/mapper/unwindowsed
    
  2. Extend VG:
    sudo vgextend ubuntu-vg /dev/mapper/unwindowsed
    
  3. Grow LV: The -r flag handles the filesystem resize for you.
    sudo lvextend -r -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
    

Pro-Tip: Use pvs, vgs, and lvs at any time to scan and verify your LVM changes. They give a quick summary of your physical volumes, volume groups, and logical volumes.


4. Making it Permanent (Mount and Chroot) — only if you have encryption

To ensure the system boots, you must update the configuration. If you are doing this from your currently running Ubuntu system, you can skip directly to editing /etc/crypttab. If you are using a Live USB, you must unlock and mount everything first.

Make sure target names are uniform across all steps (previous unwindowsed is my extra_pv). You will see LVM or initramfs warnings which will tell you more otherwise. You could use sudo vgck --updatemetadata to update metadata. On host system main_pv will probably have default name like dm_crypt-0, that's why I like doing it from LiveUSB, because I can name them to something more familiar.

  1. Unlock, Mount, and Chroot: — optional, for LiveUSB only, host already has that

    # 1. Open LUKS containers (If encrypted)
    sudo cryptsetup luksOpen /dev/nvme0n1p_UBUNTU_ROOT main_pv
    sudo cryptsetup luksOpen /dev/nvme0n1p_WINDOWS_SPACE extra_pv
    
    # 2. Ensure LVM is active
    sudo vgchange -ay
    
    # 3. Mount Root Logical Volume (this is default name from my ubuntu)
    sudo mount /dev/mapper/ubuntu--vg-ubuntu--lv /mnt
    
    # 4. Mount Boot Partition (where kernels live, e.g., p6)
    sudo mount /dev/nvme0n1p_BOOT /mnt/boot
    
    # 5. Mount EFI Partition (the small FAT32 partition, e.g., p1)
    sudo mount /dev/nvme0n1p_EFI /mnt/boot/efi
    
    # 6. Bind system directories
    for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
    sudo chroot /mnt
    
  2. Update /etc/crypttab: Use the Partition UUID from lsblk -f (found in the crypto_LUKS row), not the LVM member UUID.

    For option 2A skip keykeeper, replace /dev/...:*.key with none and skip keyscript argument:

    keykeeper    UUID=<UUID_of_keykeeper>  none  luks
    ubuntu_main  UUID=<UUID_of_ubuntu>     /dev/mapper/keykeeper:/keys/ubuntu.key  luks,keyscript=/lib/cryptsetup/scripts/passdev
    unwindowsed  UUID=<UUID_of_new_space>  /dev/mapper/keykeeper:/keys/unwindowsed.key  luks,keyscript=/lib/cryptsetup/scripts/passdev
    

    Why passdev? The keyscript=passdev option is critical for Option B. It tells the boot process to wait for a device (the keykeeper mapper) to become available before attempting to read the key file from it. Without it, the system tries to find the file before the partition is even unlocked. It also allows you to have keeper on USB to act as physical key.

  3. You may now also delete the old Windows entry from grub — check if there is a /boot/efi/EFI/Microsoft (or similar) and you can rm -rf that directory.

  4. Regenerate Boot Files:

    sudo update-initramfs -u -k all
    sudo update-grub
    
  5. Exit: exit, then unmount everything.


5. Important Note on Recovery

Always keep a LiveUSB nearby. When playing with crypttab and initramfs, a single typo can result in a "Dependency failed" boot loop or a kernel panic. If the system fails to boot, the LiveUSB is your only way to get back into the Chroot environment to fix your configuration.


After everything I have the following setup:

$ sudo pvs
  PV                   VG        Fmt  Attr PSize    PFree
  /dev/mapper/extra_pv ubuntu-vg lvm2 a--  <476,72g    0
  /dev/mapper/main_pv  ubuntu-vg lvm2 a--  <474,11g    0

$ sudo vgs
  VG        #PV #LV #SN Attr   VSize    VFree
  ubuntu-vg   2   1   0 wz--n- <950,83g    0

$ sudo lvs
  LV        VG        Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  ubuntu-lv ubuntu-vg -wi-ao---- <950,83g

$ lsblk -f
NAME                                          FSTYPE      FSVER            LABEL       UUID                                   FSAVAIL FSUSE% MOUNTPOINTS
...
nvme0n1
├─nvme0n1p1                                   vfat        FAT32                        989F-2302                               966,6M     5% /boot/efi
├─nvme0n1p2                                   crypto_LUKS 2                            fc4e684a-e281-478c-901b-6055a8cbf9fc
│ └─extra_pv                                  LVM2_member LVM2 001                     E5zuj5-lW6T-NqU6-r4mc-7iGL-pFaA-SN8BQg
│   └─ubuntu--vg-ubuntu--lv                   ext4        1.0                          f5f0f66e-fea9-48bf-b8a3-33937a51152f      482G    44% /
├─nvme0n1p6                                   ext4        1.0                          a951b0de-8f13-4934-b7f5-57cc955cdda0      1,2G    32% /boot
└─nvme0n1p7                                   crypto_LUKS 2                            143d8c65-ab06-4234-88aa-fa6d5f31aafd
  └─main_pv                                   LVM2_member LVM2 001                     VjEH89-EH3i-xd4o-WlrQ-5PTg-q7fE-dzcea0
    └─ubuntu--vg-ubuntu--lv                   ext4        1.0                          f5f0f66e-fea9-48bf-b8a3-33937a51152f      482G    44% /

# For option 2A
$ cat /etc/crypttab
main_pv         UUID=143d8c65-ab06-4234-88aa-fa6d5f31aafd       none    luks
extra_pv        UUID=fc4e684a-e281-478c-901b-6055a8cbf9fc       none    luks


Also, I went YOLO and did it without any backup, everything went well ¯\_(ツ)_/¯. If I didn't forget to update crypttab/initramfs/grub I would probably have no use of LiveUSB as well.

0

If you have a partition for Ubuntu and another for Windows you dont have to reinstall Ubuntu. you will start your laptop by Boot from an Ubuntu live USB flash drive, by disks utility format Windows partition, reboot by Ubuntu and open terminal to do thise command:

sudo update-grub 

from now no Windows operating system in your hard disk or boot menu
if (Windows Recovery Environment) in your boot menu you can remove it by Grub-customizer:

sudo apt install grub-customizer

open Grub-customizer and remove Windows Recovery Environment and save.
for full Windows uninstallation you have to delete some files from 1st partition that called System Reserved (may be 500 mg) after that

sudo update-grub

this is other wayes to remove Windows: by Gparted, OS-Uninstaller

1
  • 1
    Grub customizer is a GUI/Windows approach which might be dangerous. If you value your data ,do it by hand. Commented May 30, 2023 at 21:56

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.