Create GUID partition table (GPT) during Ubuntu Server install
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?
Solution 1:
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
Solution 2:
I suppose a direct 'yes' solution to your question is to ensure your machine boots in UEFI-only mode. This worked flawlessly for me on a SuperMicro X11 mainboard with the official 14.04.4 server installer. I did have to change the BIOS boot mode from "DUAL" (which also allows "LEGACY" boots) to "UEFI".
This yielded a /dev/sda
root disk that was GPT partitioned (with a bootable fat32 partition type EF00
) without any manual intervention. I was also able to adjust the "guided" partitioning - just because I wanted different sizes and layout, there was no need to do anything special relating to GPT.
It would be interesting to know if there are any downsides to booting in UEFI mode. Can't help but think the technology's been around long enough for issues to have been ironed out...