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

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.


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.