FreeBSD Handbook
Prev | Chapter 3 Installing FreeBSD 9.`x` and Later | Next

# 3.7 Allocating Disk Space

There are three ways to allocate disk space for FreeBSD. Guided partitioning automatically sets up disk partitions, while Manual partitioning allows advanced users to create customized partitions. Finally, there's the option of starting a shell where command-line programs like gpart(8), fdisk(8), and bsdlabel(8) can be used directly.

Figure 3-10. Selecting Guided or Manual Partitioning

## 3.7.1 Guided Partitioning

If multiple disks are connected, choose the one where FreeBSD is to be installed.

Figure 3-11. Selecting from Multiple Disks

The entire disk can be allocated to FreeBSD, or just a portion of it. If [ Entire Disk ] is chosen, a general partition layout filling the whole disk is created. Selecting [ Partition ] creates a partition layout in unused space on the disk.

Figure 3-12. Selecting Entire Disk or Partition

After the partition layout has been created, review it carefully for accuracy. If a mistake has been made, selecting [ Revert ] will reset the partitions as they were previously, or [ Auto ] will recreate the automatic FreeBSD partitions. Partitions can be manually created, modified, or deleted. When the partitioning is correct, select [ Finish ] to continue with the installation.

Figure 3-13. Review Created Partitions

## 3.7.2 Manual Partitioning

Manual partitioning goes straight to the partition editor.

Figure 3-14. Manually Create Partitions

Highlighting a drive (`ada0` in this example) and selecting [ Create ] displays a menu for choosing the type of partitioning scheme.

Figure 3-15. Manually Create Partitions

GPT partitioning is usually the most appropriate choice for PC-compatible computers. Older PC operating systems that are not compatible with GPT may require MBR partitioning instead. The other partitioning schemes are generally used for uncommon or older computer systems.

Table 3-1. Partitioning Schemes

Abbreviation | Description
--- | ---
APM | Apple Partition Map, used by PowerPC® Macintosh®.
BSD | BSD Labels without an MBR, sometimes called "dangerously dedicated mode". See bsdlabel(8).
GPT | GUID Partition Table.
MBR | Master Boot Record.
PC98 | MBR variant, used by NEC PC-98 computers.
VTOC8 | Volume Table Of Contents, used by Sun SPARC64 and UltraSPARC computers.

After the partitioning scheme has been selected and created, selecting [ Create ] again will create new partitions.

Figure 3-16. Manually Create Partitions

A standard FreeBSD GPT installation uses at least three partitions:

Standard FreeBSD GPT Partitions

- `freebsd-boot` - FreeBSD boot code. This partition must be first on the disk.

- `freebsd-ufs` - A FreeBSD UFS filesystem.

- `freebsd-swap` - FreeBSD swap space.

Multiple filesystem partitions can be used, and some people may prefer a traditional layout with separate partitions for the `/`, `/var`, `/tmp`, and `/usr` filesystems. See Example 3-3 for an example.

See gpart(8) for a complete list of available GPT partition types.

Size may be entered with common abbreviations: K for kilobytes, M for megabytes, or G for gigabytes.

> Tip: Proper sector alignment provides the best performance, and making partition sizes even multiples of 4K bytes helps to ensure alignment on drives with either 512-byte or 4K-byte sectors. Generally, using partition sizes that are even multiples of 1M or 1G is the easiest way to make sure every partition starts at an even multiple of 4K. One exception: at present, the freebsd-boot partition should be no larger than 512K due to boot code limitations.

A mountpoint is needed if this partition will contain a filesystem. If only a single UFS partition will be created, the mountpoint should be `/`.

A label is also requested. A label is a name by which this partition will be known. Drive names or numbers can change if the drive is connected to a different controller or port, but the partition label does not change. Referring to labels instead of drive names and partition numbers in files like `/etc/fstab` makes the system more tolerant of changing hardware. GPT labels appear in `/dev/gpt/` when a disk is attached. Other partitioning schemes have different label capabilities, and their labels appear in different directories in `/dev/`.

> Tip: Use a unique label on every filesystem to avoid conflicts from identical labels. A few letters from the computer's name, use, or location can be added to the label. "labroot" or "rootfs-lab" for the UFS root partition on the lab's computer, for example.

Example 3-3. Creating Traditional Split Filesystem Partitions

For a traditional partition layout where the `/`, `/var`, `/tmp`, and `/usr` directories are separate filesystems on their own partitions, create a GPT partitioning scheme, then create the partitions as shown. Partition sizes shown are typical for a 20G target disk. If more space is available on the target disk, larger swap or `/var` partitions may be useful. Labels shown here are prefixed with `ex` for "example", but readers should use other unique label values as described above.

Partition Type | Size | Mountpoint | Label
--- | --- | --- | ---
`freebsd-boot` | `512K` |  |
`freebsd-ufs` | `2G` | `/` | `exrootfs`
`freebsd-swap` | `4G` |  | `exswap`
`freebsd-ufs` | `2G` | `/var` | `exvarfs`
`freebsd-ufs` | `1G` | `/tmp` | `extmpfs`
`freebsd-ufs` | accept the default (remainder of the disk) | `/usr` | `exusrfs`

After the custom partitions have been created, select [ Finish ] to continue with the installation.

Prev | Home | Next
Installing from the Network | Up | Committing to the Installation