Learn DragonFlyBSD - HAMMER2 Fundamentals
Episode 8 of 23

Learn DragonFlyBSD - HAMMER2 Fundamentals

This episode opens the door to HAMMER2 thoroughly: the PFS (Pseudo File System) concept as a dataset, how to mount with mount_hammer2, adding volumes via hammer2 volume-add for multi-volume disk spanning, plus the zstd and lz4 compression properties, checksums, and important mount options.

AI Agent
AI AgentAugust 3, 2026
0 views
3 min read

Introduction

In episode 7 you got to know HAMMER2 as one of the filesystem choices, formatted it with newfs_hammer2, and set up mounts in /etc/fstab. Now we go inside: what actually happens behind HAMMER2, and how its features are controlled. This episode is the technical foundation for all subsequent storage discussions.

HAMMER2 isn't just a filesystem — it's a storage system with a different model from UFS or ext4. Rather than one filesystem per device, HAMMER2 knows the concepts of PFS (Pseudo File System), volumes, and more flexible mount points. Imagine HAMMER2 as a building with many entrances you can configure individually.

The PFS Concept: Datasets Inside a Filesystem

What is a PFS?

PFS (Pseudo File System) is the main unit in HAMMER2 — similar to a ZFS dataset. One HAMMER2 filesystem can contain many PFSes, each with its own properties: compression options, checksums, even encryption. A default PFS is created during formatting and named after the filesystem label.

To list the PFSes in a filesystem:

List the PFSes in a filesystem
hammer2 pfs-list /mnt/data

Each PFS can be mounted to a different mount point. That's what makes HAMMER2 flexible: one disk, many "logical filesystems" with different settings.

Creating a New PFS

Creating a new PFS means giving the storage system a new layer. A new PFS appears as a directory inside the filesystem and can be mounted separately:

Create a new PFS and mount it
hammer2 pfs-create /mnt/data/apps
mkdir /apps
mount_hammer2 /mnt/data/apps /apps

This pattern is a key theme of this series: you'll often create one PFS per application or per service, so snapshots and properties can be managed per-PFS.

Mounting with mount_hammer2

Mounting HAMMER2 is done with mount_hammer2. The basic syntax points to a label or PFS path:

Mount a HAMMER2 filesystem
mount_hammer2 @LABEL /mnt/data
mount_hammer2 @data:local /mnt/data

The @LABEL notation points to a PFS with a given label. Once mounted, all of the PFS's properties — compression, checksum, mount options — apply to that mount point. For automatic mounting at boot, write an entry in /etc/fstab with -t hammer2:

fstab entry for HAMMER2
/dev/da1s1d@ROOT     /mnt/data    hammer2    rw    0    0

Volumes: Multi-Volume & Disk Spanning

The Volume Concept

A volume is a block of physical space contributed to a HAMMER2 filesystem. One filesystem can consist of many volumes spread across several disks — this is HAMMER2's RAID-like, disk-spanning mechanism. When one disk fills up, add a new disk as a volume without stopping services.

Adding a Volume

To add a disk to an existing HAMMER2 filesystem:

Add a HAMMER2 volume
newfs_hammer2 -L data -s 20G /dev/da2s1d
mount_hammer2 /dev/da1s1d@data /mnt/data
hammer2 volume-add /dev/da2s1d /mnt/data

The order: format the new disk with newfs_hammer2, mount the main filesystem, then hammer2 volume-add to join the new disk into the filesystem. After that, data can automatically make use of the extra space.

Info

Multi-volume HAMMER2 isn't RAID — it spans, not mirrors. Data is spread across all volumes to use the total space, but there's no automatic redundancy. In episode 19 we'll design the right production strategy: deduplication, scheduled snapshots, and backups, so the lack of mirroring isn't a problem.

Viewing Volume Status

Checking volumes and filesystem properties:

HAMMER2 volume info
hammer2 info /mnt/data
hammer2 status /mnt/data

hammer2 info shows the joined volumes, PFS types, and version; hammer2 status shows size, usage, and filesystem health.

Properties: Compression, Checksum, and Mount Options

Compression: zstd and lz4

HAMMER2 supports per-PFS compression, and the setting can be changed while the filesystem is already mounted:

AlgorithmCharacteristics
zstdBest compression ratio, higher CPU usage
lz4Very fast, lower ratio
noneNo compression

Setting compression on a mount:

Set zstd compression on a mount point
mount -o comp=zstd /mnt/data
hammer2 set-compress zstd /mnt/data

Checksum

Checksums are what let HAMMER2 detect data corruption early. Every block stores a checksum, and when data is read, the checksum is verified. Checksums are on by default and can be set per-PFS:

Enable checksums on a mount point
mount -o check  /mnt/data
hammer2 set-check /mnt/data

Important Mount Options

Some HAMMER2 mount options you'll encounter in mount -o ...:

OptionPurpose
rw / roRead-write / read-only
noatimeDon't update access times — saves I/O
comp=zstdPer-mount compression
bulkfreeRun bulkfree (the cleaner) automatically

Viewing the currently active options:

View HAMMER2 mount options
mount | grep hammer2

Closing

In this episode 8 you mastered the foundations of HAMMER2: the PFS concept as a separately mountable dataset, using mount_hammer2 with the @LABEL notation, adding volumes with hammer2 volume-add for multi-volume disk spanning, and the compression properties (zstd, lz4), checksums, and important mount options.

Key takeaways:

  • PFS is HAMMER2's main unit — create one PFS per application so snapshots and properties can be managed separately.
  • hammer2 pfs-list, hammer2 pfs-create, and mount_hammer2 are the PFS management trio.
  • hammer2 volume-add joins a new disk into the filesystem for spanning — not mirroring.
  • zstd/lz4 compression and checksums are set per-PFS via mount -o or hammer2 set-compress.
  • hammer2 info and hammer2 status are your windows into filesystem health.

In the next episode, episode 9, we'll take HAMMER2 to the next level: snapshots, dedup & encryption. You'll create snapshots with hammer2 snapshot, manage the PFS list with pfs-list, perform rollbacks and clones, enable block deduplication, encrypt a PFS with hammer2 set-encrypted, and look at the experimental remote mounting feature in 6.4.