4

I am trying to install Ubuntu Server 18.04 LTS on an existing partition on a Win 10 + Ubuntu machine (replacing the existing 16.04). However, on the disk setup stage, the installer does not show any existing partitions on the disk and treats everything as free space. I have referred to some links (e.g. this tutorial, this manual partitioning and this) but did not find anything useful. Can someone provide any guidance on this?

The following is the output for fdisk -l

Disk /dev/loop0: 495.4 MiB, 519491584 bytes, 

1014632 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop1: 149.5 MiB, 156753920 bytes, 306160 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop2: 37 MiB, 38805504 bytes, 75792 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop3: 21.5 MiB, 22528000 bytes, 44000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop4: 86.6 MiB, 90759168 bytes, 177264 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop5: 44.6 MiB, 46792704 bytes, 91392 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 29A3046E-B1A3-4A8A-94DF-FE9F225635A0

Device          Start        End   Sectors   Size Type
/dev/sda1          34     262177    262144   128M Microsoft reserved
/dev/sda2      264192  524552191 524288000   250G Microsoft basic data
/dev/sda3   524552192 1048840191 524288000   250G Microsoft basic data
/dev/sda4  1048840192 1832280063 783439872 373.6G Microsoft basic data
/dev/sda5  1832280064 1848662015  16381952   7.8G Microsoft basic data
/dev/sda6  1848664064 1953521663 104857600    50G Linux filesystem



Disk /dev/sdb: 223.6 GiB, 240057409536 bytes, 468862128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 4783D55B-A479-4449-8D39-7DFAB78B25DF

Device         Start       End   Sectors   Size Type
/dev/sdb1       2048    923647    921600   450M Windows recovery environment
/dev/sdb2     923648   1126399    202752    99M EFI System
/dev/sdb3    1126400   1159167     32768    16M Microsoft reserved
/dev/sdb4    1159168 362372980 361213813 172.2G Microsoft basic data
/dev/sdb5  362373120 364001279   1628160   795M Windows recovery environment
/dev/sdb6  364003328 468860927 104857600    50G Linux filesystem


Disk /dev/sdc: 3.8 GiB, 4022337024 bytes, 7856127 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x1c0522c6

Device     Boot   Start     End Sectors  Size Id Type
/dev/sdc1  *          0 1650687 1650688  806M  0 Empty
/dev/sdc2       1575508 1580179    4672  2.3M ef EFI (FAT-12/16/32)

On the disk partitioning screen, the installer states

No disks or partitions mounted

and then shows the disks as completely available in available devices.

Edit:

Found a similar bug report, discussion. I am not sure if this has been fixed.

Abhay Mittal
  • 41
  • 1
  • 3
  • @K7AAY pasted it above. – Abhay Mittal May 15 '18 at 18:36
  • Uh ... why in heck did they remove the ability to use current partitioning (worked years ago)? I can't even find a *hack* to work around this. I can't imagine the only solution being preseeding or kickstart, but has anybody tried using one of those two options to work around this? – r2evans Dec 27 '18 at 01:11
  • Forget that ... section B.1.2 states: "You must (re)partition an entire disk or use available free space on a disk; it is not possible to use existing partitions." (emphasis mine) – r2evans Dec 27 '18 at 01:13
  • Abhay, if by chance you are still perplexed by this, I found some more context and a sensible workaround in my related question, https://askubuntu.com/a/1104810/399638. – r2evans Dec 27 '18 at 06:30

2 Answers2

0

Sorry about the short answer, but you can delete the existing partition you want to install on and use the free space to make a new partition. This is a bad idea though, because you may delete a partition with important data.

(Keep in mind I have no idea how vanilla Server works, I've only used the Pi version)

Amint
  • 434
0

For those drawn by the original title: "Ubuntu server install on existing partition".

As of the 21.01.2 installer shipped with Fossa (possibly even earlier), you can install Server to an existing partition without changing your disk scheme or even formatting the targeted root partition.

Disclaimers

Any evolution of this nature puts ALL data on EVERY disk in your system at risk. You could lose it all. Be sure you are prepared with adequate backups.

This procedure does not cover the inevitable Windows Bootloader repair for dual-boot Windows/Linux situations - only Ubuntu Server installation to an existing partition.

Finally, I highly recommend that you run through this procedure on a disposable system (as I am doing on this virtual machine) before attempting on a live system.

Outline

In the following example, I will install Server 20.04.2 to an existing root partition preserving the existing operating system (22.04.2) in its own BTRFS subvolume. This will allow me to manually select the supplanted OS at GRUB time.

Procedure

Boot to your source media and proceed with installation until you reach the "Guided storage configuration" portion.

If you need to do some disk preparation (and I do), Select "Help" and "Enter Shell" which will drop you to a root shell.

Shell

In the following, I create a new default BTRFS subvolume to receive the installation giving it the same name as the original so as to avoid any GRUB confusion.

BTRFS config

Exit the shell and select "Custom storage layout".

The installer must have a boot device defined to proceed with the installation.

If you are performing this on a dual boot Windows/Linux system be sure you know how to repair your Windows boot loader because I don't cover that in this procedure.

Carrying on, select your boot drive and define it as your boot device. Any existing /boot/efi partition should be reused automatically.

Boot Device

If you have a swap partition you wish to reuse, select and edit thusly:

Swap Partition

Finally, select and edit your target root partition thusly:

Root Partition

Note that root "/" is not available as an option unless you format but you can select "Other" and then specify root, noting the warnings.

You can now proceed with the remainder of the installation as normal.

Desktop Installation

Outside the scope of this Question but surely someone will come looking ...

The Fossa and Jammy desktop installers also appear to support installing to an existing unformatted partition.

DesktopCnfg DesktopWarn

But they crash as soon as they try to write to it. Whoever wrote the python script did not anticipate the scenario of installing to an existing filesystem. For the time being, apparently, you must format the target partition.

Frobozz
  • 689