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.
This guide is based on steps found at this page: https://help.ubuntu.com/community/MovingLinuxPartition
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
andext3
also - It should also work with versions of Ubuntu
- Theorietically, this should work with
- GRUB 2.04
- A ~500GB NVME SSD using a GPT (instead of a MBR)
This does not remove the Windows Boot Manager option from your GRUB menu. It's almost certainly doable, but I don't know how and can't be bothered to find out how.
Also, read these instructions and make sure they don't seem stupid before you blindly follow them.
- 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
- Boot to the live USB and ensure that none of the machine's existing paritions are mounted
- Using gparted or similar:
- Delete the Windows partition.
- In my case, I also deleted the
Microsoft reserved partition
and NTFS partition labelledWinRE_DRV
shown in the above image.
- In my case, I also deleted the
- 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
)
- Delete the Windows partition.
- 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
.
- In my case, the command ended up looking like
- Reboot, ensuring that you boot back to the live USB.
- Run
blkid
again to verify that this has been changed.
- First, in a terminal, run
- 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
.
- For now, ignore any comments saying not to edit this file because it's automatically generated by
- Mount the new partition to your chosen mount path, denoted as
- 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.
- Ensure the new partition is still mounted at
- 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
.
- I used
- 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.
- Mount the EFI system partition (in my case,
- Reboot the machine, and select the option for your Linux Mint installation
- From here onwards, you should no longer need the live USB.
- 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.
- In my case, the following line was present:
- Open Gparted and do the following:
- Delete the old Linux partition.
- Resize the new Linux partition to fill the empty space.
- Apply the operations.
- Reboot for good measure
- 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.
- Run
- Reboot another time for good measure
- If everything worked correctly, breathe a sigh of relief. You're done! 🎉