Wed Jun 18 19:04:58 ICT 2014

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.
  1. Create the GPT partition scheme:
    gpart create -s GPT da2
  2. Create a boot partition:
    gpart add -t freebsd-boot -s 512k da2
  3. Create the root partition:
    gpart add -t freebsd-ufs -s 4g da2
  4. Create the swap partition:
    gpart add -t freebsd-swap -s 4g da2
  5. Create the usr partition:
    gpart add -t freebsd-ufs -s 20g da2
  6. Create the var partition:
    gpart add -t freebsd-ufs -s 4g da2
  7. Create other partition(s) (omit the -s to use the remaining of the disk):
    gpart add -t freebsd-ufs da2
  8. 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.

Posted by Olivier | Permanent link | File under: administration, freebsd