How do I delete Ubuntu 18.04

Hello, on my Fujitsu E920 desktop with i5 processor I have Windows 10 and Ubuntu 18.04 on HDD1 sda1 to sda5, and on HDD2 sdb5 Ubuntu 22.04 plus a separate data partition for Backups. Now I want to get rid of Ubuntu 18.04 to get more space on HDD1. How do I delete 18.04. Thanks in advance, HHarry18

Make sure to restore the Windows bootloader first.
Once that’s done, you need a partition management program, preferably from a usb stick, or some such.
Use the partition manager found in there to reorganize your partitions.
Done.

All of this is said assuming UEFI.

1 Like

The best partition manager is gparted.
It is graphic, you can see what you are doing.
You could launch gparted either from the Ubuntu on HDD2 or from a usb stick as @xahodo suggests.

Carefully identify which partition on HDD1 is Ubuntu18 and use the Partition button and choose Format then ext4.
You have to Apply this change after selecting it.

Simply reformatting the partition is the easiest way to delete
Ubuntu18. It will then be ready to use as a data partition.
For that purpose you would want to mount it from Ubuntu22.

2 Likes

Which partition does it boot from?

Where is grub?

I’m always very nervous about messing with that because you might end up rendering your computer unbootable.

2 Likes

Gparted is ok to remove the partition in linux and it exists in windows but there is a built in partition manager in windows which is perhaps better to use

https://www.makeuseof.com/ways-open-disk-management-windows-10/#:~:text=Select%20System%20and%20Security%20and,partitions%20to%20open%20Disk%20Management.

But you also need to change the booting system as mentioned in the grub

Don’t forget to format the windows partition in a suitable format for windows such as fat 32 or ntfs

In the end you may have to re install windows to confirm it working correctly.

Also back up your data befoee starting just in case and anything on your ubuntu drive will be lost on formatting.

Does beg the question why ditch linux and choose windows, normally here its the other way around get rid of windows and go just for linux

3 Likes

This is confusing. Why does @HHarry18 need to touch Windows? He just wants to remove Ubuntu18.

I agree with @pdecker , he needs to be careful which Ubuntu is in charge of grub. He needs to make Ubuntu22 in charge of grub, and he can do that by going into Ubuntu22 and doing
grub install for legacy boot
or
grub install --efi-directory= for efi boot
update grub
That will put grub on HDD2 and control it with Ubuntu22.
Then he can safely reformat the Ubuntu18 partition.

2 Likes

Sorry my mistake it should say
Use windows to format the linux partition into a format windows can read such as fat

You cannot use the linux partition or tools to remove itself, hence you need to boot into windows and do all the changes using tools from that system and part.

2 Likes

Sorry, my mistake. I thought the OP wanted to get rid of Linux altogether. Now I read the post again, I see I had misread.

1 Like

I thought the same, but reading again there are two versions of ubuntu 18 and 22 so yes working in the 22 version to get rid of 18 will work but with caution.

1 Like

Right,
or you can use gparted from a bootable usb drive.
or you can use gparted in Ubuntu22 to delete Ubuntu18

5 Likes

Does he also want to run grub update again after deleting Ubuntu 18 to remove it from the
grub menu?

1 Like

Hello everybody, thanks very much for your replies. Nice to see you back nevj, you helped me many times in the past! As I explained in my request Windows 10 (which I seldom use) and Ubuntu 18.04 are on HDD1, Ubuntu 22.04 and backup data are partitions on HDD2. I used Gparted to check this and checked Grub as well: Ubuntu 18.04 is in sda5 (HDD1) and 22.04 is in sdb5 (HDD2), so far, so good. Now the first item in Grub is Ubuntu 18.04. I tried to change 22.04 to be the first choice in Grub many times but did not succeed, though I never had a problem with it in other machines. Just set default is 1 less then its place in the Grub list and update Grub afterwards. As Grub has a length of 8 (!) printed pages I am afraid that if I format the 18.04 partition, Grub won’t know where to start then. Hope I made it a bit clearer and that you can take away my fear. HHarry18

So are you saying Ubuntu 18 is listed first when you boot your PC?
That tells me U 18 was the last OS that updated grub. If you do as @nevj said in posting 16 it should put Ubuntu 22 in first place.

In other words, boot your PC from Ubuntu 22 and install grub from Ubuntu 22. This will make Ubuntu own grub and place it at the top of the boot menu.

As always, have a backup your system.

3 Likes

I always end up using Grub Customizer to make updates to the Grub menu.

I haven’t used Ubuntu 18.04 for a very long time now, I always boot up with 22.04. I’ĺl try @nevj’s suggestion shortly.

I dont recommend that .
Grub customizer can permanently damage your grub config.

Yes, he needs that.

Hi Neville, thanks for your help again. I have never used Grub Customizer because of the damage you and other people mentioned before.
By the way, where do I start grub install --efi-directory= for efi boot in the Terminal? I have booted Ubuntu 22.04 which is on sdb5 (HHD2) and opened the terminal.
Do I have to reinstall Grub here, using sudo grub-install /dev/sdb5 and sudo upgrade-grub? If I type in grub install --efi-directory= for efi boot it says that it cannot find grub. Or shoul it be:
grub install --efi-directory=/mnt/sdb5 ? HHarry18

Yes in the terminal.
It is a command line instruction

You basically want Ubuntu22 to control grub, and the way to do that is to install grub from Ubuntu22.
You will need an EFI system partition on the same disk ad Ubuntu22… that partition will get mounted to /boot/efi in Ubuntu22, so what you do is

grub-install --efi-directory=/boot/efi

Note grub-install has a minus in it.

Afterthought. I think it might be possible for the EFI system partition to be on the other disk. Not sure. What did you tell Ubuntu22 when you installed it , about where to put grub?

1 Like


I did not tell Ubuntu22 where to put grub, I upgraded 20.04 and it did everything automatically. I attached a GParted copy of HDD2 on which you can see /boot/efi on /dev/sdb2.
So, grub-install --efi-directory=/boot/efi should do the trick, I hope.