Datasets and Properties
A pool is a pile of space; datasets are how it is carved up. Creating a dataset is cheap and does not preallocate anything, so the usual ZFS practice is to create many of them — one per workload, per user, per application — rather than one big file system with directories.
Dataset types
- File system
A POSIX file system, mounted somewhere. The default type.
- Volume (zvol)
A block device exported under
/dev/zvol/<pool>/<name>. Used for virtual machine disks, iSCSI targets, swap, or file systems ZFS does not implement.- Snapshot and bookmark
Read-only, covered in Snapshots, Clones and Bookmarks.
zfs create pool/home
zfs create pool/home/alice
zfs create -V 40G pool/vm/disk0 # a zvol
zfs list # file systems and volumes
zfs list -t all -r pool # everything, recursively
zfs destroy pool/home/alice
Datasets form a hierarchy that mirrors their names, and most properties are inherited down that hierarchy — which is the main reason to nest them deliberately.
Properties
Everything about a dataset’s behavior is a property: where it mounts, how it compresses, whether it is read-only, how much space it may use.
zfs get all pool/home/alice
zfs get -r compression,recordsize pool
zfs get -o name,property,value,source -s local all pool/home
zfs set compression=zstd pool/home
zfs inherit compression pool/home/alice # fall back to the parent's value
zfs inherit -S compression pool/home/alice # revert to the received value
Some properties are read-only (used, available, creation,
compressratio), some can only be set at creation time (casesensitivity,
normalization, encryption, volblocksize), and the rest can be
changed at any time. Changes to properties that affect how data is written —
recordsize, compression, checksum, dedup, copies — apply
only to newly-written blocks.
Property sources
zfs get reports where each value came from:
localSet directly on this dataset.
inherited from <dataset>Set on an ancestor.
defaultNever set anywhere; the built-in default.
temporarySet for the current mount only, via a mount option.
receivedCarried in a
zfs receivestream.noneRead-only property with no source.
This is the first thing to check when a dataset does not behave as expected — a value inherited from three levels up is easy to miss.
Properties worth knowing
Layout and mounting
mountpointWhere the file system mounts.
legacyhands control to/etc/fstabormount;nonemeans it is not mounted. Inherited children extend the parent’s path automatically.canmounton,offornoauto.offmakes a dataset a pure property-inheritance container that is never mounted, while still having an inheritablemountpoint.noautomeans it mounts only when asked explicitly — the basis of boot environments.readonlyBlocks writes to the dataset. Standard on replication targets.
Data layout
recordsizeThe maximum block size for a file system. Default 128 KiB; matching it to the application’s I/O size matters for databases and VM images.
volblocksizeThe fixed block size of a zvol. Set at creation only.
compression,checksum,dedup,copiesSee Compression, Checksums and Deduplication.
Behavior
atime/relatimeAccess-time updates.
atime=offremoves a write for every read;relatime=onis the usual compromise.syncstandard,always, ordisabled.disabledignores fsync — it does not corrupt the pool, but it does lose recently written data on a crash.exec,setuid,devicesThe usual mount-option semantics, as properties.
sharenfs,sharesmbExport the dataset; see Sharing datasets.
quota,refquota,reservation,refreservation
Space accounting
usedSpace charged to this dataset and its descendants.
referencedSpace reachable from this dataset alone — what a snapshot of it would reference.
availableSpace still usable, after quotas and reservations.
logicalused/logicalreferencedThe same before compression.
usedby*usedbydataset,usedbysnapshots,usedbychildrenandusedbyrefreservationbreakuseddown — the fastest way to find where space went.
zfs list -o name,used,usedbydataset,usedbysnapshots,usedbychildren -r pool
User properties
Arbitrary properties can be attached to datasets for use by tooling. They have
no effect on ZFS itself. A user property name must contain a colon, which is
what distinguishes it from a native one; the convention is
module:property, with the module part typically a reversed domain name.
zfs set com.example:backup=daily pool/home
zfs get -r -o name,value com.example:backup pool
Because they inherit like native properties, user properties are a convenient way to drive snapshot and replication policy from the dataset tree itself.
Further reading
zfsprops(7) — the complete property reference