How to prepare a disk on an EFI based PC for Ubuntu?

39,029

Solution 1

The most convenient and reliable way to prepare a disk is using the GNOME partition editor. GParted is included in the Ubuntu installation media, but in some cases it is better to use the original. When you boot from the Ubuntu install media and you already have a swap partition,
the partition is mounted. Partition swapoff and unmount unfortunately does not always work.


Use GParted from the Ubuntu installation media ... in case it does not work you can
download GParted from the project website and create a bootable DVD/USB media.

Boot from GParted Live media, once on the desktop GParted opens automatically.
Choose the disk you want to work on from the application menu on the top right.

Click on DeviceCreate Partition Table → Select gpt → Click Apply

Click on PartitionCreate new Partition:
New size: about 500 MB - File system: fat32

Click on PartitionCreate new Partition:
New size: amount of RAM - File system: linux-swap

Click on PartitionCreate new Partition:
New size: minimum 20 GB - File system: ext4

Optionally create more partitions:

Click on PartitionCreate new Partition:
New size: arbitrary - File system: arbitrary

These partitions can be used to store the personal data that are separated from the system. Use ext4 when Ubuntu or other Unix/Linux based systems are the only systems that need to access them. When you want to make the data accessible to Windows as well, choose ntfs or fat32.

Click on Apply after checking that everything is correct, wait until GParted completed the tasks.

Right-click the fat32 partition → Manage flags → Select boot and esp.

Now close GParted, shut down the computer, remove the GParted Live media.

Boot from Ubuntu installation media and select Try Ubuntu without installing.
On the desktop click Install Ubuntu and when asked, choose 'Something else'.

Select the ext4 partition you have created with GParted for Ubuntu before.
Select / as mount point and ext4 as file system ... start the installation.


Presentation : How to set up a disk and create new partitions with GParted

Example : Prepare the disk for the installation using an Ubuntu Live media

Additional information concerning swap : Community Help Wiki SwapFAQ


Note:

Doing it this way has one big advantage: You decide yourself about the whole partition layout and can prepare everything for eventual changes being made in the future. The partition sizes are suggestions, users of course shall choose them fitting to their needs. What first looks a bit complicated, is, once you have understood the systematic behind it and done it one time, easy.

Solution 2

You can do everything from inside the Ubuntu installer. The minimum effort option is to select one of the "Use whole disk" variants, which should already do the right thing.

If you want to customize the partition layout, you can use the partition editor inside the installation tool as well, the only important bit is that you need to keep one FAT partition for the EFI binaries. This can be fairly small, since all that really needs to fit is three kernels (backup and running, and enough space to install updates), but unless space is really tight, 256 to 512 MB is a good value.

Last but not least: Ubuntu can only install an EFI bootloader if the system was booted in EFI mode, because the BIOS compatibility layer does not allow access to the boot menu, so the bootloader cannot be registered.

Share:
39,029

Related videos on Youtube

cl-netbox
Author by

cl-netbox

Updated on September 18, 2022

Comments

  • cl-netbox
    cl-netbox over 1 year

    My computer has UEFI based BIOS and I want to start over from scratch.

    The PC came with Windows installed - I later installed Ubuntu alongside.

    I want to completely re-build my whole disk and install only Ubuntu on it.

    So it is not about how to install Ubuntu, it is about how to prepare a disk.

    What is the most professional way and which tasks will I have to perform?

    • muru
      muru about 8 years
      I assume you have gone through askubuntu.com/q/221835/158442? I'd say the simplest way is: enable legacy (BIOS) booting in UEFI, then install Ubuntu choosing the use entire disk option.
    • muru
      muru about 8 years
      You should have added an answer to that Q then. This has already been asked: askubuntu.com/questions/420272/…
    • Rod Smith
      Rod Smith about 8 years
      Muru, if you want to boot in EFI/UEFI mode, enabling the Compatibility Support Module (CSM; aka "legacy boot support" or a similar phrase) is something you should almost certainly NOT do. See here for details on why this is the case. Two or three times a week, I answer questions from people who've bungled their installations because they've activated their CSMs.
    • muru
      muru about 8 years
      @RodSmith see the original question. If I were wiping Windows and starting from scratch and looking for the simplest way, I wouldn't bother with UEFI at all. In fact, using CSM is exactly what I do when I don't want to bother about anything else. No need for this special partitioning and ESP and whatnot.
    • Rod Smith
      Rod Smith about 8 years
      Muru, modern computers use EFI (or UEFI, which is EFI 2.x), so you can't avoid it. At best, you add complexity by enabling the CSM. Granted, the native EFI method of booting is different and unfamiliar to long-time BIOS users, but it's no harder once you understand it. If you understand neither BIOS nor EFI, you might as well learn EFI, since BIOS is a dead-end technology.
    • muru
      muru about 8 years
      @RodSmith use @muru to notify me. Now, CSM might add complexity to somebody, but that somebody isn't me (probably the poor sod who has to write the firmware, but not me, the user). All I need to do is toggle a setting in UEFI. After that, no special partitions required, and practically any bootable image would do, no worries about the version of GRUB, no worries about EFI files being overwritten by overzealous installers. You might want to try it sometime, when you're wiping your whole disk and installing just Ubuntu. UEFI is a good thing, for sure, but for whom?
  • muru
    muru about 8 years
  • nobody
    nobody about 8 years
    This is way over-complicated. The installer can do it all automatically.
  • nicorellius
    nicorellius over 5 years
    I think the complexity of this answer is spot on, as this whole Grub EFI package bug is a PITA (as it helps to have details). For learning about how these things work, this level of complicated-ness is helpful. However, all that said, this answer might be a bit slim after the formatting steps. I found myself wondering whether I should reformat the ext4 partition when installing the OS (eg, whether to check the box when setting the mount point). If you don't (which is the right answer), the startup disk warns/asks questions about existing file systems, overwriting data.