Install FreeBSD 10 on gmirror/gstripe/simple UFS partitions (GPT or MBR)

Option 2. Partition the drives (GPT)

by ross at 14:30:48 on December 18, 2013

Create GPT partition table

If the drive is empty:

# gpart create -s gpt ada1
ada1 created

# gpart show ada1
=>       34  976773101  ada1  GPT  (465G)
         34  976773101        - free -  (465G)

Create the partitions

This example shows how to create mirrored, striped and simple UFS partitions. This is just an example, you might want to rethink which partitions will be striped, mirrored or simple.

Create boot partition:
# gpart add -s 512k -t freebsd-boot ada1
ada1p1 added
Create root (/) partition (will be mirrored, needs ada2p2):
# gpart add -s 2G -t freebsd-ufs -l root0 ada1
ada1p2 added
Create swap partition:
# gpart add -s 2G -t freebsd-swap -l swap0 ada1
ada1p3 added
Create /var partition (will be mirrored, needs ada2p4):
# gpart add -s 2G -t freebsd-ufs -l var0 ada1
ada1p4 added
Create /usr partition (will be mirrored, needs ada2p5):
# gpart add -s 15G -t freebsd-ufs -l usr0 ada1
ada1p5 added
Create /usr/ports partition (striped, 5G x 2 = 10G, needs ada2p6):
# gpart add -s 5G -t freebsd-ufs -l ports0 ada1
ada1p6 added
Create /usr/home partition (will be mirrored, needs ada2p7):
# gpart add -s 50G -t freebsd-ufs -l home0 ada1
ada1p7 added
Create /share partition (neither mirrored not striped):
# gpart add -t freebsd-ufs -l share ada1
ada1p8 added

Last partition is added without the -s flag so it will cover the rest of the space.

Install boot code

# gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada1
bootcode written to ada1

Create partitions on the second disk

Repeat these steps for your second disk (which is ada2 here). This example assumes that there will be no ada2p8, i.e. the second disk is smaller than the first one and /share will be created on the first disk only.