How to initialize new disk for UEFI/GPT

gptpartitionuefi

Background

I'm setting up a new build, with all new hardware, tabula rosa. I want to have multiple Linux installations and common data partitions.

From what I'e gathered so far, using new hardware and up-to-date kernels, I should be able to use rEFInd as a simple boot manager and use a fully modern boot process.

I've read Rod's general instructioms, but I need some more specific advice.

Question

Since disk partition editors tend to "helpfully" hide the EFI partition, how can I set that up on a new unformatted disk?

With gparted 0.16.1, I created a gpt type partition table. But, there's no indication that this is the case: the display looks no different than before or a legacy partion table in place. So did it do anything? The New partition command gives no options for the special EFI reserved partition, so did it do that automatically too?
screenshot

Constraints and Assumptions

There is no existing OS, and no optical drives. Assume that any existing contents on the ssd should be blown away (junkware from the manufacturer or previous attempts to partition). I'm booting UBCD from a USB thumbdrive, so using gparted or other tools included in the Partion Magic image would be easiest.

Once I have a proper GPT disk with the special EFI partition, I'm comfortable using gparted etc. for addional partions, as I've done as long as there have been PC's with HDD's.

Best Answer

Current util-linux versions of fdisk support GPT, the one I'm looking at here is fdisk from util-linux 2.24.2 (reported via fdisk -v).

Run fdisk /dev/whatever. Have a look at the options with m. Note these change depending on the state of the partition table. First check what state the disk is currently in with p. Note the Disklabel type; if it is gpt you don't have to do anything, you can delete the existing partitions and start creating your own.

If not, use the g option. This will eliminate any existing partitions because fdisk does not convert the MBR table. You can now start adding partitions with n. For the EFI partition, use t to set the type to 1, then the table should read, e.g.,

 Device    Start          End   Size Type
 /dev/sdb1   256    122096640 465.8G EFI System

Obviously that's a bit silly, but hopefully the point is clear. None of your changes take effect until you use w and exit.

Related Question