UEFI Partitioning for Dummies

Solution 1:

Partitioning is the very easy part. For all the partitioning tasks you should use a partitioning software like GParted which ships with the Ubuntu Live ISO image. A tool like the Ubuntu installer, which oversimplifies things, is probably the main reason why you're confused.

For proper EFI partitioning and installing you need to:

  1. Have a GPT partition table on the hard drive you want to install to.

    • You can verify this in GParted via menu entries View -> Device Information. If the partition table attribute reads msdos instead of gpt, then it's wrong and might get messy if you continue. Unfortunately creating a new partition table destroys the existing one and all data on the disk.

    • Related: How can I check and change the partition table type?

  2. Have a EFI system partition (ESP).

    • A EFI system partition has the partition type ef00 and usually contains a FAT32 file system.
    • Given that you have a GPT partition table, if the checkbox for boot is ticked in GParted's manage flags dialog on the partition that is meant to be your ESP and the partition contains a FAT32 file system everything is good. If not tick the checkbox for boot and ensure that none of the other partitions has this flag set, because as you already found out, there can only be one ESP. (Yes, the boot flag in GParteds GUI equals partition type ef00, however this is not the real GUID used in GPT for the ESP, see Wikipedia for a list of partition type GUIDs and the comment below by user Rod Smith, and also the footnote in the article about manufacturer specific boot partitions.)
  3. Create the remaining partitions needed for the OS and boot the installation media in UEFI mode.

    • Your proper partition setup is almost complete. Just add the partitions you want for your new OS installation as you see fit. You can do this via the Ubuntu installer or GParted, it's up to you and you can't do much wrong here. (The de facto default file system for Linux is EXT4. You can't install to FAT32, because due to this file systems limited feature set.)
    • If you haven't booted the installation media in UEFI mode, you need to reboot and explicitly boot in UEFI mode. UEFI needs to be enabled in you computers firmware setup screen (formerly/usually called BIOS). Instructions on how to boot and verify that the installation media booted in UEFI mode can be found in the community documentation. From there on the Ubuntu installer should know that it should do a UEFI installation.
    • Secure boot should work with Ubuntu 12.10 64-bit and 12.04.2 64-bit and newer installation media (see: How do I install Ubuntu alongside a pre-installed Windows with UEFI?).

You can do UEFI installations on MBR partitioned disks and do certain hacks/kludges, but a setup verified to be like this will give you the least amount of trouble and everything should work fine. I found the Arch Linux UEFI wiki page very detailed and helpful for learing more on the whole topic and doing some hacks.


Known UEFI bugs and implementation shortcomings:

  • Wikipedia about Lenovo, Toshiba, Samsung without going into much detail.
  • Computers from 2011 or earlier may feature a UEFI firmware, but the implementation may not always provide a UEFI boot interface. Source: Talk at LCA 2013 from Dong Wei - UEFI, the Converged Firmware Infrastructure (http://mirror.linux.org.au/linux.conf.au/2013/mp4/ file UEFI_the_Converged_Firmware_Infrastructure.mp4 - at around 12:14)

Solution 2:

Actually partitioning for an EFI-based Ubuntu installation is no harder than partitioning for a BIOS-based installation. If you've read a guide to Ubuntu installation or partitioning, the changes for an EFI-based installation are:

  • You generally use the GUID Partition Table (GPT) for EFI rather than the older Master Boot Record (MBR). On a system with Windows already installed, this should already be done, and the Ubuntu installer will detect and use the GPT partitions just fine. Using GPT does have some further implications, though, as detailed below....
  • GPT doesn't use extended or logical partition types. Instead, GPT supports up to 128 (by default; that limit can be raised) partitions. Some tools refer to these as "primary partitions," although in the absence of extended and logical partition types, the designation "primary" is meaningless. The point of all this is that you can ignore any instructions to create an extended partition or to create a certain mix of primary and logical partitions.
  • The current version of Ubuntu has a bug that causes it to use the Windows filesystem type code for Linux partitions. This causes your Ubuntu filesystem partition(s) to show up in Windows as unpartitioned disks. The solution is to use gdisk to change the type code of your Ubuntu filesystem partition(s) from 0700 to 8300. This problem is covered in more detail on this page. You can make this change after installing Ubuntu.
  • GPT doesn't use cylinder/head/sector (CHS) values. Older documentation may refer to this, or to "cylinder alignment." Ignore such references. (You might also look for newer documentation, since CHS issues are obsolete even for new installations on BIOS-based computers.)
  • An EFI-based installation stores its boot loader in the EFI System Partition (ESP) rather than in the MBR. Thus, you must have an ESP, which the Ubuntu installer refers to an an "EFI boot partition." If the computer already boots another OS in EFI mode, it will already have an ESP. I recommend backing up any existing ESP before you proceed, just in case of an accident. (A file-level backup should work fine.) On a system with Windows 8 pre-installed, the ESP is usually one of the first three partitions on the disk. It always uses a FAT (usually FAT32) filesystem, so you can identify it in this way on the partitioning screen. In GParted or parted it will have its "boot flag" set, and in gdisk it will have a type code of EF00.

Other partitioning issues are common across firmware and partition table types. In particular, Ubuntu defaults to using two partitions: One for the root (/) filesystem and another for swap space. Many users like to split off /home or other directories into their own partitions, and some like to use Logical Volume Manager (LVM) setups. The issues related to such things are the same for EFI and GPT as they are for MBR and BIOS, so refer to any of the hundreds of sites that cover such issues.

Solution 3:

How I installed my system, but I have secure boot off in bios, so I am not sure that it will work:

  1. Create new partition table on your hard disk in GPT mode. (Warning: this will erase all data on the disk!) Then you must create a 100 MB fat32 partition labeled 'EFI' and flagged 'boot'. and the system partitions, so:

    • sda1: 100mb, fat32, EFI, boot flag set
    • sda2: 30gb, ext4, kali-linux
    • sda3: 4gb, swap, swap for kali&ubuntu
    • sda4: 60gb, ext4, ubuntu
    • sda5: 250gb, ntfs, windows 8.1
    • sda6: 382gb, ntfs, datas
  2. (optional) Install Kali-linux, While installing make sure to mount the 100 MB fat32 as /boot/efi. Do the rest as usual.

  3. Install Windows 8. It will automatically identify the EFI system partition, create a MSFTRES, and a NTFS where it installs itself. After installation we can only boot into Windows, but we will fix that later.

  4. Ubuntu, while installing select the 100 MB fat32 and change it into 'use as efi'. Create an ext4, install Ubuntu. Upon rebooting we are presented with win8 loader. in bootmenu choose ubuntu end get into it.

  5. Now we will configure GRUB2 to detect Windows. open a root nautilus, navigate to /boot/efi/EFI delete the boot folder and copy the boot folder from the microsoft folder to the windows partition and after delete the microsoft folder. Aft r go to /etc/default/grub and comment out the 2 line start with "GRUB_HIDDEN". Next, the entry for windows can be manually added by appending the following lines to /etc/grub.d/40_custom:

    menuentry "Windows" {
            search --fs-uuid --no-floppy --set=root YOUR-EFI-PARTITIONS-UUID-HERE
            chainloader (${root})/Boot/bootmgfw.efi
    }
    

And finally type sudo update-grub. Welcome in the working system.