Partitioning using gdisk

Notes Before We Begin

These install instructions assume you are installing Funtoo Linux to an empty hard disk using GUID partition tables (GPT). If you are installing Funtoo Linux on a machine where another OS is installed, or there is an existing Linux distribution on your system that you want to keep, then you will need to adapt these instructions to suit your needs.

If you are going to create a legacy MBR partition table instead of GUID/GPT, you will use the fdisk command instead of gdisk, and you will not need to create the GRUB boot loader partition. See the table under Partitioning Recommendations, in particular the
MBR Block Device (fdisk) and MBR Code columns. fdisk works just like gdisk, but creates legacy MBR partition tables instead of the newer GPT/GUID partition tables.

Using gdisk

The first step after booting SystemRescueCd is to use gdisk to create GPT (also known as GUID) partitions, specifying the disk you want to use, which is typically /dev/sda, the first disk in the system:

# gdisk /dev/sda

You should find gdisk very similar to fdisk. Here is the partition table we want to end up with:

Above, you'll see that we have a 500 MiB boot partition, a 32 MiB "BIOS boot partition" (also known as the GRUB boot loader partition), 4 GiB of swap, and the remaining disk used by a 107.7 GiB root partition.

For new gdisk users

These partitions were created using the "n" command from within gdisk. The gdisk commands to create the partition table above are as follows. Adapt sizes as necessary, although these defaults will work for most users. The partition codes entered below can be found in the Partitioning Recommendations table below, in the GPT Code column.

Within gdisk, follow these steps:

Create a new empty partition table (This will erase all data on the disk when saved):

Along the way, you can type "p" and hit Enter to view your current partition table. If you make a mistake, you can type "d" to delete an existing partition that you created. When you are satisfied with your partition setup, type "w" to write your configuration to disk:

Write Partition Table To Disk:

Command: w ↵
Do you want to proceed? (Y/N): Y ↵

The partition table will now be written to disk and gdisk will close.

Now, your GPT/GUID partitions have been created, and will show up as the following block devices under Linux:

/dev/sda1, which will be used to hold the /boot filesystem,

/dev/sda2, which will be used directly by the new GRUB,

/dev/sda3, which will be used for swap space, and

/dev/sda4, which will hold your root filesystem.

For Previous fdisk users

If you have installed Gentoo Linux before, the one thing that is likely new to you here is the GRUB boot loader partition, which is listed as "BIOS boot partition" within gdisk. This partition is required for GRUB 2 to boot GPT/GUID boot disks. What is it? In GRUB-speak, this partition is essentially the location of the meat of GRUB's boot loading code. If you've used GRUB Legacy in the past, this partition is where the new GRUB stores the equivalent of the stage1_5 and stage2 files in legacy GRUB. Since GPT-based partition tables have less dead space at the beginning of the disk than their MBR equivalents, an explicitly defined partition of code EF02 is required to hold the guts of the boot loader.

In all other respects, the partition table is similar to that which you might create for an MBR-based disk during a Gentoo Linux installation. We have a boot and a root partition with code 0700, and a Linux swap partition with code 8200.