Ubuntu – Create GUID partition table (GPT) during Ubuntu Server install

alternategptpartitioningserver

On a computer with a new empty hard drive of capacity < 2 TB, I install Ubuntu Server with the standard text-mode installer. I choose to manually partition the disk. Then I can create a new empty partition table. This will be a legacy partition table. However, I want a GPT one, but I didn't find a way to select it.

I've tried to switch to a text console via Alt + F2. However, the command gdisk is not available (neither is fdisk).

I know that I could boot some live linux first to create the partition table (which seems unnecessarily cumbersome). So my question is explicitly about the standard Ubuntu Server text-mode installer. Is there a way to create a GUID partition table (GPT) during the install?

Best Answer

Test this:

You switch to a text console via Alt + F2.

Try to create a partition start GNU parted as follows:

sudo -i
parted /dev/sda

Output:

GNU Parted 2.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)

Creates a new GPT disklabel i.e. partition table:

mklabel gpt

Sample outputs:

Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes

Next, set the default unit to TB, enter:

unit TB

To create a 2TB partition size, enter:

mkpart primary 0.00TB 2.00TB

To print the current partitions, enter:

print

Sample outputs:

Model: ATA ST33000651AS (scsi)
Disk /dev/sda: 2.00TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number  Start   End     Size    File system  Name     Flags
 1      0.00TB  2.00TB  2.00TB  ext4         primary

Quit and save the changes, enter:

quit

Use the mkfs.ext4 command to format the file system, enter:

mkfs.ext4 /dev/sda1