I have a UEFI laptop with two disks, /dev/sda and /dev/sdb. Ubuntu 16.04 is installed on /dev/sdb. There is already an ext4 partition of /dev/sda, but I want anything there to be overwritten. I wish to install Ubuntu 20.04 on /dev/sda, such that: 1) During a transition period, I can boot from either Ubuntu 16.04 or Ubuntu 20.04 2) After a transition period, I will delete Ubuntu 16.04 from /dev/sdb 3) I don't have to physically disconnect /dev/sdb before doing the installation

I boot the computer from a USB with the Ubuntu 20.04 image on it. When I get to the screen asking for the installation type:

Q1) I presume I should choose "Something else", because installing Ubuntu 20.04 alongside 16.04 will install it on /dev/sdb, which I do not want. Is this correct?

Q2) After selecting "Something else", do I choose /dev/sda or do I choose /dev/sda1 (which already has the ext4 filesystem on it)?

Q3) On the same screen, where I am asked for the device for the boot loader installation, the options are: /dev/sda /dev/sda1 /dev/sdb /dev/sdb1 /dev/sdb2 Ubuntu 16.04 LTS Given my goals as described above, which option should I choose?

2 Answers 2

  • I suggest that you start by unplugging /dev/sdb. That way there is no risk that you will touch it during the installation.

  • After that it is straightforward to install Ubuntu 20.04 LTS into /dev/sda. Reboot and check that it works.

  • Next shutdown and connect /dev/sdb.

  • Boot into /dev/sda and from there run

    sudo update-grub

    It should identify the operating system in /dev/sdb and add a grub menuentry for it.

  • When you no longer want the old operating system you can remove it (by erasing it or unplugging the drive). Then run

    sudo update-grub

    and the menuentry for it will be removed.

  • When I tried the first approach, grub-install failed. I then tried the second approach (removing a disk, then installing). It worked fine.
    – Amblymoron
    May 1, 2020 at 14:38
  • @Amblymoron, I'm that it worked fine for you :-)
    – sudodus
    May 1, 2020 at 18:21
  • I have exactly the same problem as the OP also with 16.04 on sdb and 18.04 on sda. Now I want to remove 16.04 from boot but without deleting the partition /dev/sdb3 which contains the 16.04 installation. Preferably I would like to do all necessary steps from inside running ubuntu 18.04 and keep the data of my 16.04 ext4 partition intact. May 4 at 1:44
  • @JürgenBöhm, Why do you want to remove it from the boot menu? It doesn't do any harm except making the grub menu longer. - But if you don't want the system to recognize other systems, when refreshing the boot menu, you can try with sudo chmod -x /etc/grub.d/30_os-prober. (It can be activated again by sudo chmod +x /etc/grub.d/30_os-prober) - After that, run sudo update-grub to make the change. The change should persist through automatic updates too.
    – sudodus
    May 4 at 7:21

First of all make a backup of your important files on /dev/sda. Installing an OS is usually harmless but risky thing. So if you care for your files, make a backup somewhere else.

Since you intend to install 20.04 on this disk, you should choose the Something else option and then you may choose to:

  1. resize the current /dev/sda1 partition to create space for the new 20.04 partition or
  2. Install 20.04 in /dev/sda1 without formatting it. (This option may not be viable if it contains conflicting files like another OS for example.)

In both cases, since you intend to eventually keep Ubuntu 20.04 and delete 16.04, install Grub in /dev/sda. When the time comes to delete 16.04, make sure to update-grub after deleting it before rebooting to avoid facing a grub rescue screen.

A word of caution: Referring to disks as sda and sdb is risky. These are assigned by the OS and may change. So be sure that sda is really the disk you want to use for your 20.04 installation by using other information, like disk size or UUID.

  • The Ubuntu installation program shows the partition /dev/sdb2 as the place where Ubuntu 16.04 is installed, so I suppose that there will be no confusion about which disk is which.
    – Amblymoron
    Apr 29, 2020 at 15:47
  • So after selecting to install on /dev/sda1 (which uses 100% of the disk), I also need to indicate where to mount root. But, can I just define the root mount point there, or do I also need to set up a swap partition and an efi partition, as was done when Ubuntu 16.04 was installed? Or does the installation program take care of those partitions for me?
    – Amblymoron
    May 1, 2020 at 13:08
  • @Amblymoron, Where the bootloader is installed depends on the boot mode. Do you install in UEFI mode or BIOS mode (alias CSM alias legacy mode)? But you can control where to install the root partition. At the partitioning window you should select 'Something else' alias manual partitioning. - You need not specify a swap partition with 20.04 LTS. It will create a swap file automatically (in the root of the root partition: /swapfile.
    – sudodus
    May 1, 2020 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.