---
title: Moving From a Dual-Boot to a Mono-Boot Linux Installation
publishedDate: 2023-05-21
tags: [linux, guide]
---
This guide details the steps I took to turn my Windows-Linux Mint dual-booted Thinkpad E14 into a Linux-only machine while preserving the existing Linux installation. It only applies if both operating systems are installed on the same drive and if the Windows installation is before the Linux installation on the disk.

In my case, my drive looked like this before any action was taken. The large partition on the left is Windows, the immediately adjacent one on the right is Linux.

[![partitions.jpg](partitions.jpg)](partitions.jpg)

This guide is based on steps found at this page: [https://help.ubuntu.com/community/MovingLinuxPartition](https://help.ubuntu.com/community/MovingLinuxPartition)

# Specification

These instructions are based on my experience doing this on a machine with the following specification:

* Linux Mint 20.3 Una installed on an `ext4` partition
	* Theorietically, this should work with `ext2` and `ext3` also
    * It should also work with versions of Ubuntu
* GRUB 2.04
* A ~500GB NVME SSD using a GPT (instead of a MBR)

# Disclaimer

Read these instructions before you use them, and make sure they don't seem stupid. This guide in no way guarantees that you won't somehow wreck your OS installs or your entire computer.

# Instructions

1. **Obtain a live USB of any Linux operating system, ideally with Gparted preinstalled**
	* I used a Linux Mint 21 live USB
    * Note that any alternative tools to Gparted should also work
2. **Boot to the live USB and ensure that none of the machine's existing paritions are mounted**
3. **Using gparted or similar:**
	* Delete the Windows partition.
		* In my case, I also deleted the `Microsoft reserved partition` and NTFS partition labelled `WinRE_DRV` shown in the above image.
    * Make a copy of the Linux partition into the now-unallocated space.
    * Expand the copied partition to fill all available space.
    * Apply these actions, making a note of the path of the copied partition (in my case, the new partition became `/dev/nvme0n1p2`)
4. **Set a new UUID on the copied partition**
	* First, in a terminal, run `blkid`. Check that there are two entries that have matching UUIDs. One should be the partition you just created, and one should be the source partition.
    	* It may be useful to make a note of the UUID of the source partition.
    * Generate a new UUID using the following command: `python3 -c 'import uuid; print(str(uuid.uuid4()))'`
    * Run `sudo tune2fs -U <generated UUID> <copied partition path>`, replacing the sections in angled brackets with your values and accepting any warnings about the command taking a long time to run.
    	* In my case, the command ended up looking like `sudo tune2fs -U bc170102-11ac-4e9f-93fe-74dacfb5ac85 /dev/nvme0n1p2`.
    * Reboot, ensuring that you boot back to the live USB.
    * Run `blkid` again to verify that this has been changed.
5. **Alter the new partition's GRUB configuration**
    * Mount the new partition to your chosen mount path, denoted as `<mount path>` for the rest of this guide.
    * Make a back-up of `<mount path>/boot/grub/grub.cfg`, ideally to the live USB.
    * Find and replace all references to the old partition's UUID in `<mount path>/boot/grub/grub.cfg` with the new partition's UUID. Save these changes.
    	* For now, ignore any comments saying not to edit this file because it's automatically generated by `grub-mkconfig`.
6. **Alter the new partition's `/etc/fstab` to mount the correct partition as the root directory**
	* Ensure the new partition is still mounted at `<mount path>`.
    * Make a back-up of `<mount path>/etc/fstab`, ideally to the live USB.
    * Open `<mount path>/etc/fstab` as a super user and replace the first (and hopefully only) occurrence of the old partition's UUID with the new partition's UUID.
    * If you have any, comment out or remove any lines that reference the now-non-existent Windows partition. I had a line that looked like `/dev/disk/by-uuid/FCC8AB67C8AB1EC0   /media/akp/Windows      auto    nosuid,nodev,nofail,x-gvfs-show 0       0` that I commented out.
7. **Alter the EFI system partition to make it load the partition with the new UUID**
	* Mount the EFI system partition (in my case, `/dev/nvme0n1p2`) to your chosen mount path, denoted as `<efi mount path>` for the rest of this step.
    	* I used `/boot/efi`.
    * Open `<efi mount path>/EFI/ubuntu/grub.conf` as a super user and replace the old partition's UUID in the first line with the new partition's ID. Save these changes.
8. **Reboot the machine, and select the option for your Linux Mint installation**
    * From here onwards, you should no longer need the live USB.
9. **Open a terminal and run `lsblk`. You should see that your new partition is mounted at `/`**
	* In my case, the following line was present: `nvme0n1p2 259:2    0 476.7G  0 part /`
    * If you do not see your new partition mounted as `/`, something has gone wrong. Good luck.
10. **Open Gparted and do the following:**
	* Delete the **old** Linux partition.
    * Resize the new Linux partition to fill the empty space.
    * Apply the operations.
11. **Reboot for good measure**
12. **Regenerate the GRUB config**
	* Run `sudo grub-mkconfig -o ~/grub.cfg`
    * Check the contents of `~/grub.cfg` to make sure that it uses the correct partition UUID and/or partition path (I can't work out if the partition path is used or not - my config didn't seem to include it).
    * If all looks good, run `sudo mv ~/grub.cfg /boot/grub/gruv.cfg`, overwriting the old GRUB configuration.
13. **Reboot another time for good measure**
14. **If everything worked correctly, breathe a sigh of relief.** You're done! 🎉

To remove the left-over Windows Boot Manager entry from the GRUB boot menu, I followed these instructions: https://askubuntu.com/a/1370744
