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?
5 Answers
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/sdaOutput:
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 gptSample 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? yesNext, set the default unit to TB, enter:
unit TBTo create a 2TB partition size, enter:
mkpart primary 0.00TB 2.00TBTo print the current partitions, enter:
printSample 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 primaryQuit and save the changes, enter:
quitUse the mkfs.ext4 command to format the file system, enter:
mkfs.ext4 /dev/sda1 5 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...
To find the gdisk package:find /cdrom | grep gdisk
To install it:udpkg -i /cdrom/<blah>
You will need to repeat this a couple of times to install libstdc++, libgcc_s and perhaps one or two other shared libraries that are missing from the Ubuntu Server 15.10 installer image, before the installed gdisk package will run.
You'll get a couple of errors while installing shared libraries because udpkg is not apt-get and does not resolve dependencies. Ignore the errors, gdisk will still work.
Fdisk does not work for GPT, currently. But parted does. Or you can just easily install gdisk.
At the current time the installer does not let you select. At some point over 1.5TB (if drive is unpartitioned) or is UEFI it defaults to GPT, otherwise it defaults to MBR and is not otherwise selectable.
Convert to msdos or gpt, if you have data may be destructive, so have good backups:
sudo parted /dev/sda
mklabel msdos/gpt
quitYou can easily install gdisk:
sudo apt-get install gdiskGPT Advantages (older but still valid) see post#2 by srs5694:
4The simplest way for me was to boot into the the existing installation :
apt-get install gdisk
gdisk /dev/vda
& write (option o in gdisk) a GPT partition table (which allocated 1 MiB of space at the beginning & end of the disk & preserved a protected copy of the MBR).
I then rebooted from the CD & chose Rescue Mode& mounted the root partition from the existing installation & ran :
/sbin/gdisk /dev/vda
& created the gpt partitions setting the correct partition types :
You will need to reboot the machine again so the kernel reads the new partition table & begin the installation.
During installation I set :
Partition 1:
1 MiB EF02 as filesystem type reserved-bios
Partition 2:
250 MiB EF00 as ext4 with noatime,nodiratime mounted @ /boot & marked bootable
More in general
"Zoraya ter Beek, age 29, just died by assisted suicide in the Netherlands. She was physically healthy, but psychologically depressed. It's an abomination that an entire society would actively facilitate, even encourage, someone ending their own life because they had no hope. Th…"