Partition a disk with GPT
I need to write down the steps to partition a disk with
gpart.
This is not compatible with MBR and Windows
partitions.
- Create the GPT partition scheme:
gpart create -s GPT da2
- Create a boot partition:
gpart add -t freebsd-boot -s 512k da2
- Create the root partition:
gpart add -t freebsd-ufs -s 4g da2
- Create the swap partition:
gpart add -t freebsd-swap -s 4g da2
- Create the usr partition:
gpart add -t freebsd-ufs -s 20g da2
- Create the var partition:
gpart add -t freebsd-ufs -s 4g da2
- Create other partition(s) (omit the -s to use the
remaining of the disk):
gpart add -t freebsd-ufs da2
- Make the disk bootable:
gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 da2
Use
gpart show da2 to see the partition table. Now you can
create the file system on
/dev/da2p2,
/dev/da2p4,
/dev/da2p5, etc.