Creating EFI bootable GPT partition with gdisk on previous MBR, GPT Damaged

43,242

Quoting the Ubuntu UEFI Community Wiki. The same Rules apply regardless of Distribution.

Creating an EFI partition

If you are manually partitioning your disk in the Ubuntu installer, you need to make sure you have an EFI partition set up.

  1. If your disk already contains an EFI partition (eg if your computer had Windows8 preinstalled), it can be used for Ubuntu too. Do not format it. It is strongly recommended to have only 1 EFI partition per disk.
  2. An EFI partition can be created via a recent version of GParted (the Gparted version included in the 12.04 disk is OK. Note: I've included a link to the GParted LiveCD), and must have the following attributes:

    • Mount point: /boot/efi (remark: no need to set this mount point when using the manual partitioning, the Ubuntu installer will detect it automatically)
    • Size: minimum 100Mib. 200MiB recommended.
    • Type: FAT32
    • Other: needs a "boot" flag.

See this screenshot, which will give you an idea for layout. (Notice /dev/sda1, I apologize for relying on Ubuntu shots again.) You may create this partition by resizing your arch install if need be. This is also a layout for OSX, so if you want to dual boot with Win8, you would combine sda2 and sda3 from the screenshot below into 1 partition of type ntfs, and then sda4, sda5, and sda6, would be used for Arch.

GParted Partition Map with UEFI


Regarding LVM

I believe LVM can be used, but experience would dictate that the EFI partition and mount point you create cannot exist inside a volume group, nor should it exist as a volume. In order to keep your EFI partition "clean," create a partition that isn't part of any LV.

Share:
43,242

Related videos on Youtube

maple_shaft
Author by

maple_shaft

Updated on September 18, 2022

Comments

  • maple_shaft
    maple_shaft over 1 year

    So this is a sister question to my previous one about partitioning for a UEFI boot loader. Parititioning for a UEFI boot loader, can LVM be used?

    Disclaimer: I don't give a flip about the data on it. Windows 8 can die in a fire.

    Following instructions I have a single 400MB device that I think was previously a 'Microsoft Reserved' partition of some kind (I believe it was an MBR partition?). Before I realized what I had to do I deleted the existing partition with the fdisk utility and created an MBR partition with an ext4 filesystem and rebooted for changes to take effect.

    I then realized that this won't work for the UEFI firmware, a firmware so hipster and awesome that it just has to be different in every way. I went into gdisk this time and searched for partitions, it found none. I created a new GUID partition on this 400MB device with the proper EFI type code EF00 I believe. This appeared to be successful so I made a FAT32 filesystem on it, mkfs -t fat32 /dev/sda1 and this was successful.

    I followed all the instructions to install Arch Linux from the bootable Installation CD that happened to boot in UEFI mode I might add. I got to the point where I installed gummiboot on the system and it immediately informed me that my device sda1 is not a proper EFI partition. Thoroughly confused I did a gdisk -l on the device and found that it identified the GPT partition is damaged and the MBR partition still exists.

     Partition table scan:
      MBR: MBR only
      BSD: not present
      APM: not present
      GPT: damaged
    

    It then presented three options, MBR, GPT or clean GPT. I chose GPT thinking it would remove the MBR partition tables but it doesn't make a difference.

    Realizing I am beyond my knowledge at this point and have no clue how to create a proper GPT partition from an existing MBR partition, I ran a Quick Analyse on testdisk and everything looks good and green. The testdisk utility recognizes this as a proper EFI bootable partition in every respect.

    I would like to repair the GPT partition if possible so I can avoid all of the installation and customization steps of starting over in my Arch installation. If this is not possible and I have to destroy this partition and start over is there a way I can save the data that was already installed here and manually add it back after I have fixed the boot partition?

    • Admin
      Admin over 9 years
      Did you try the verify or repair commands in gdisk? Don't forget to write the changes after making repairs.
    • Admin
      Admin over 9 years
      The 400MB partition was probably your EFS, which had all of the information (like .efi files) for your UEFI to load the OS's. Try using sgdisk again on the partition you have already set up. Usually size is 512MB though. (I can't remember why exactly, I think it may be arbitrary)
    • Admin
      Admin over 9 years
      @psusi I feel like I tried this and nothing happened. Maybe I forgot to write changes after making repairs? I will try again when I get home tonight.
    • Admin
      Admin over 9 years
      After attempting to repair boot partitions and several more installs and failed Grub installation attempts, I got fed up and scorched earth the damn SSD. After zero filling everything it seems like everything is working fine now. The boot loader actually installed correctly now! I blame Microsoft.
  • maple_shaft
    maple_shaft over 9 years
    Please read my comment on the question. Thanks for your help. This answer was informative but I eventually had to give up and zero fill the drive.
  • eyoung100
    eyoung100 over 9 years
    @maple_shaft I hate that you had to lose all the data, but I hope my answer helped afterwards