ZFS(8)
๐ ZFS(8) โ the zfs girlies' guide ๐
System Manager's Manual โจ like, the whole manual, but make it make sense
๐ธ NAME ๐ธ
zfs โ configure ZFS datasets. that's it, that's the vibe. she configures. datasets. slay. ๐
โจ SYNOPSIS โจ
zfs -?V
zfs version [-j]
zfs subcommand [arguments]
๐ฆ DESCRIPTION ๐ฆ
okay so bestie, listen. the zfs command is the one that configures ZFS datasets inside a ZFS storage pool โ and like, the pool stuff itself lives over in zpool(8), we don't do that here. a dataset is identified by a unique path inside the ZFS namespace, and it looks like this:
pool[/component]/component
for example:
rpool/var/log
and now the โจrulesโจ because there are always rules:
- the maximum length of a dataset name is
ZFS_MAX_DATASET_NAME_LEN - 1ASCII characters (currently255) and it has to satisfy[A-Za-z_.:/ -]. yes, that's the whole character buffet. - snapshots are allowed to contain a single
@character ๐ - bookmarks are allowed to contain a single
#character /is used as the separator between components- the maximum amount of nesting allowed in a path is
zfs_max_dataset_nestinglevels deep. don't push her. - ZFS tunables (
zfs_*) are explained inzfs(4), go look if you're nosy (affectionate).
a dataset can be one of these four things, and honestly? iconic lineup:
- file system โ can be mounted within the standard system namespace and behaves like other file systems. while ZFS file systems are designed to be POSIX-compliant, known issues exist that prevent compliance in some cases. so like, applications that depend on standards conformance might fail due to non-standard behavior when checking file system free space. not her fault, just the lore. ๐
- volume โ a logical volume exported as a raw or block device. this type of dataset should only be used when a block device is required. file systems are typically used in most environments. so like, don't be dramatic and use a volume when you don't need one.
- snapshot โ a read-only version of a file system or volume at a given point in time. it is specified as
filesystem@nameorvolume@name. a little time capsule, a little freeze-frame. ๐ธ - bookmark โ much like a snapshot, but without the hold on on-disk data. it can be used as the source of a send (but not for a receive). it is specified as
filesystem#nameorvolume#name.
see zfsconcepts(7) for details, if you want the deep lore. ๐
๐ Properties ๐
properties come in two flavors: native properties and user-defined (or "user") properties. native properties either export internal statistics or control ZFS behavior. plus, native properties are either editable or read-only. user properties have no effect on ZFS behavior at all โ but you can use them to annotate datasets in a way that's meaningful in your environment. cute little sticky notes. ๐
for more info about properties, see zfsprops(7).
๐ Encryption ๐
enabling the encryption feature allows for the creation of encrypted filesystems and volumes. ZFS will encrypt file and zvol data, file attributes, ACLs, permission bits, directory listings, FUID mappings, and userused/groupused/projectused data. yes bestie, all of it. for an overview of encryption, see zfs-load-key(8). ๐ซถ
๐ SUBCOMMANDS ๐
heads up: all subcommands that modify state are logged persistently to the pool in their original form. so like, the pool remembers. forever. no cap.
zfs -?โ displays a help message. the classic cry for help, but helpful.zfs -V,--versionzfs version [-j]โ displays the software version of thezfsuserland utility and thezfskernel module. use the-joption to output in JSON format. ๐ค
๐ Dataset Management ๐
zfs-list(8)โ lists the property information for the given datasets in tabular form.zfs-create(8)โ creates a new ZFS file system or volume.zfs-destroy(8)โ destroys the given dataset(s), snapshot(s), or bookmark.zfs-rename(8)โ renames the given dataset (filesystem or snapshot).zfs-upgrade(8)โ manage upgrading the on-disk version of filesystems.
๐ธ Snapshots ๐ธ
zfs-snapshot(8)โ creates snapshots with the given names.zfs-rollback(8)โ roll back the given dataset to a previous snapshot.zfs-hold(8)/zfs-release(8)โ add or remove a hold reference to the specified snapshot or snapshots. if a hold exists on a snapshot, attempts to destroy that snapshot by using thezfs destroycommand returnEBUSY. so like, she's held, okay?zfs-diff(8)โ display the difference between a snapshot of a given filesystem and another snapshot of that filesystem from a later time or the current contents of the filesystem.
๐ง Clones ๐ง
zfs-clone(8)โ creates a clone of the given snapshot.zfs-promote(8)โ promotes a clone file system to no longer be dependent on its "origin" snapshot. glow up moment. โจ
๐ค Send & Receive ๐ฅ
zfs-send(8)โ generate a send stream, which may be of a filesystem, and may be incremental from a bookmark.zfs-receive(8)โ creates a snapshot whose contents are as specified in the stream provided on standard input. if a full stream is received, then a new file system is created as well. streams are created using thezfs-send(8)subcommand, which by default creates a full stream.zfs-bookmark(8)โ creates a new bookmark of the given snapshot or bookmark. bookmarks mark the point in time when the snapshot was created, and can be used as the incremental source for azfs sendcommand.zfs-redact(8)โ generate a new redaction bookmark. this feature can be used to allow clones of a filesystem to be made available on a remote system, in the case where their parent need not (or needs to not) be usable. mysterious. love that for her. ๐ถ๏ธ
๐ Properties ๐
zfs-get(8)โ displays properties for the given datasets.zfs-set(8)โ sets the property or list of properties to the given value(s) for each dataset.zfs-inherit(8)โ clears the specified property, causing it to be inherited from an ancestor, restored to default if no ancestor has the property set, or with the-Soption reverted to the received value if one exists.
๐ Quotas ๐
zfs-userspace(8)/zfs-groupspace(8)/zfs-projectspace(8)โ displays space consumed by, and quotas on, each user, group, or project in the specified filesystem or snapshot.zfs-project(8)โ list, set, or clear project ID and/or inherit flag on the files or directories.
๐๏ธ Mountpoints ๐๏ธ
zfs-mount(8)โ displays all ZFS file systems currently mounted, or mount ZFS filesystem on a path described by itsmountpointproperty.zfs-unmount(8)โ unmounts currently mounted ZFS file systems.
๐ค Shares ๐ค
zfs-share(8)โ shares available ZFS file systems.zfs-unshare(8)โ unshares currently shared ZFS file systems.
๐ก๏ธ Delegated Administration ๐ก๏ธ
zfs-allow(8)โ delegate permissions on the specified filesystem or volume.zfs-unallow(8)โ remove delegated permissions on the specified filesystem or volume.
๐ Encryption ๐
zfs-change-key(8)โ add or change an encryption key on the specified dataset.zfs-load-key(8)โ load the key for the specified encrypted dataset, enabling access.zfs-unload-key(8)โ unload a key for the specified dataset, removing the ability to access the dataset.
๐ญ Channel Programs ๐ญ
zfs-program(8)โ execute ZFS administrative operations programmatically via a Lua script-language channel program. yes, Lua. she contains multitudes. ๐
โ๏ธ Data rewrite โ๏ธ
zfs-rewrite(8)โ rewrite specified files without modification.
๐ Jails ๐
zfs-jail(8)โ attaches a filesystem to a jail.zfs-unjail(8)โ detaches a filesystem from a jail.
โณ Waiting โณ
zfs-wait(8)โ wait for background activity in a filesystem to complete. the "girl just give it a sec" subcommand. ๐ซถ
๐ฆ EXIT STATUS ๐ฆ
the zfs utility exits 0 on success, 1 if an error occurs, and 2 if invalid command line options were specified. three moods. that's the whole emotional spectrum. ๐ญ
๐ EXAMPLES ๐
Example 1: Creating a ZFS File System Hierarchy
the following commands create a file system named pool/home and a file system named pool/home/bob. the mount point /export/home is set for the parent file system, and is automatically inherited by the child file system. so like, the baby gets the parent's whole setup for free. generational wealth. ๐
# zfs create pool/home
# zfs set mountpoint=/export/home pool/home
# zfs create pool/home/bob
Example 2: Creating a ZFS Snapshot
the following command creates a snapshot named yesterday. this snapshot is mounted on demand in the .zfs/snapshot directory at the root of the pool/home/bob file system.
# zfs snapshot pool/home/bob@yesterday
Example 3: Creating and Destroying Multiple Snapshots
the following command creates snapshots named yesterday of pool/home and all of its descendent file systems. each snapshot is mounted on demand in the .zfs/snapshot directory at the root of its file system. the second command destroys the newly created snapshots. create then destroy, the full circle of life. ๐
# zfs snapshot -r pool/home@yesterday
# zfs destroy -r pool/home@yesterday
Example 4: Disabling and Enabling File System Compression
the following command disables the compression property for all file systems under pool/home. the next command explicitly enables compression for pool/home/anne.
# zfs set compression=off pool/home
# zfs set compression=on pool/home/anne
Example 5: Listing ZFS Datasets
the following command lists all active file systems and volumes in the system. snapshots are displayed if listsnaps=on. the default is off. see zpoolprops(7) for more information on pool properties.
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
pool 450K 457G 18K /pool
pool/home 315K 457G 21K /export/home
pool/home/anne 18K 457G 18K /export/home/anne
pool/home/bob 276K 457G 276K /export/home/bob
Example 6: Setting a Quota on a ZFS File System
the following command sets a quota of 50 Gbytes for pool/home/bob:
# zfs set quota=50G pool/home/bob
Example 7: Listing ZFS Properties ๐
okay bestie, this one is the ~big reveal~ โ every single property on pool/home/bob, all at once. Run this and it's giving full inventory, no cap:
# zfs get all pool/home/bob
NAME PROPERTY VALUE SOURCE
pool/home/bob type filesystem -
pool/home/bob creation Tue Jul 21 15:53 2009 -
pool/home/bob used 21K -
pool/home/bob available 20.0G -
pool/home/bob referenced 21K -
pool/home/bob compressratio 1.00x -
pool/home/bob mounted yes -
pool/home/bob quota 20G local
pool/home/bob reservation none default
pool/home/bob recordsize 128K default
pool/home/bob mountpoint /pool/home/bob default
pool/home/bob sharenfs off default
pool/home/bob checksum on default
pool/home/bob compression on local
pool/home/bob atime on default
pool/home/bob devices on default
pool/home/bob exec on default
pool/home/bob setuid on default
pool/home/bob readonly off default
pool/home/bob zoned off default
pool/home/bob snapdir hidden default
pool/home/bob acltype off default
pool/home/bob aclmode discard default
pool/home/bob aclinherit restricted default
pool/home/bob canmount on default
pool/home/bob xattr on default
pool/home/bob copies 1 default
pool/home/bob version 4 -
pool/home/bob utf8only off -
pool/home/bob normalization none -
pool/home/bob casesensitivity sensitive -
pool/home/bob vscan off default
pool/home/bob nbmand off default
pool/home/bob sharesmb off default
pool/home/bob refquota none default
pool/home/bob refreservation none default
pool/home/bob primarycache all default
pool/home/bob secondarycache all default
pool/home/bob usedbysnapshots 0 -
pool/home/bob usedbydataset 21K -
pool/home/bob usedbychildren 0 -
pool/home/bob usedbyrefreservation 0 -
look at all those defaults and locals and little -s โ that last column is literally the receipts for where each value came from. ๐
and if you only want one lil value? grab it like this:
# zfs get -H -o value compression pool/home/bob
on
just on. that's it. that's the whole meal. โจ
and if you wanna see only the stuff that was set locally (as in, not inherited from anyone), bestie, say less:
# zfs get -r -s local -o name,property,value all pool/home/bob
NAME PROPERTY VALUE
pool/home/bob quota 20G
pool/home/bob compression on
two rows. iconic. the way -s local just filters out all the inherited noise?? obsessed. ๐
Example 8: Rolling Back a ZFS File System ๐
say you fumbled and need to go back to how things were. this command rewinds the contents of pool/home/anne back to the snapshot named yesterday, and โ heads up โ it deletes all intermediate snapshots on the way. gone. poof.
# zfs rollback -r pool/home/anne@yesterday
the -r is the "and also nuke everything between here and there" flag. very main character, very destructive. know that before you hit enter, fr fr. ๐ญ
Example 9: Creating a ZFS Clone ๐ฆ
a clone is a writable file system that starts out with the same contents as a snapshot. watch:
# zfs clone pool/home/bob@yesterday pool/clone
now pool/clone is a whole writable vibe that started life as pool/home/bob@yesterday. cute. ๐
Example 10: Promoting a ZFS Clone ๐
okay this one is the โจplot twistโจ example. you wanna test some changes on a copy, then swap it in for the original like nothing happened. clones + promotion + renaming, all together:
# zfs create pool/project/production
populate /pool/project/production with data
# zfs snapshot pool/project/production@today
# zfs clone pool/project/production@today pool/project/beta
make changes to /pool/project/beta and test them
# zfs promote pool/project/beta
# zfs rename pool/project/production pool/project/legacy
# zfs rename pool/project/beta pool/project/production
once the legacy version is no longer needed, it can be destroyed
# zfs destroy pool/project/legacy
read that again, bestie โ you make a clone, you test your lil changes on it, you promote it so it becomes the real one, you rename the old one out of the way to legacy, you rename the beta into the production slot, and then once legacy is just sitting there collecting dust you destroy it. chef's kiss. the glow-up was real. ๐
Example 11: Inheriting ZFS Properties ๐
want a dataset to stop being special and just take after its parent? say less:
# zfs inherit checksum pool/home/bob pool/home/anne
boom โ pool/home/bob and pool/home/anne now inherit the checksum property from their parent. generational. ๐ซถ
Example 12: Remotely Replicating ZFS Data ๐ธ
sending your data to another machine across the internet?? long-distance relationship energy, but make it storage. here you send a full stream first, then an incremental one:
# zfs send pool/fs@a |
ssh host zfs receive poolB/received/fs@a
# zfs send -i a pool/fs@b |
ssh host zfs receive poolB/received/fs
the full stream lands as poolB/received/fs@a, and the incremental stream lands as poolB/received/fs@b. important deets: poolB has to already contain the file system poolB/received, and it must not already contain poolB/received/fs at the start. no pre-existing copies, bestie. โจ
Example 13: Using the zfs receive -d Option ๐
this is the -d slay. you send poolA/fsA/fsB@snap off to a remote machine, and it gets received into poolB/received/fsA/fsB@snap. the fsA/fsB@snap part of the new name? it's literally derived from the name of the snapshot you sent. mind. blown.
# zfs send poolA/fsA/fsB@snap |
ssh host zfs receive -d poolB/received
rules of the game: poolB must already contain the file system poolB/received. and if poolB/received/fsA doesn't exist yet? it just gets created as an empty file system. no complaints, no drama. ๐
Example 14: Setting User Properties ๐
you can make up your OWN properties, bestie. user-defined, your rules. this one sets com.example:department on a dataset:
# zfs set com.example:department=12345 tank/accounting
custom property, custom lore. ๐ท๏ธ
Example 15: Performing a Rolling Snapshot ๐
this is the "keep a tidy rotation going" example โ a whole week's worth of snapshots with a consistent naming scheme. the move is: destroy the oldest, rename the rest down the line, then make a fresh one. like a lil conveyor belt:
# zfs destroy -r pool/users@7daysago
# zfs rename -r pool/users@6daysago @7daysago
# zfs rename -r pool/users@5daysago @6daysago
# zfs rename -r pool/users@4daysago @5daysago
# zfs rename -r pool/users@3daysago @4daysago
# zfs rename -r pool/users@2daysago @3daysago
# zfs rename -r pool/users@yesterday @2daysago
# zfs rename -r pool/users@today @yesterday
# zfs snapshot -r pool/users@today
see how everything shuffles down by one and @today becomes the new baby at the top? it's giving organized. it's giving consistent. it's giving no notes. ๐
Example 16: Setting sharenfs Property Options on a ZFS File System ๐ฆ
wanna share a file system over NFS with specific rules? watch this โ it enables read-write access for a set of IP addresses and enables root access for a system named neo on tank/home:
# zfs set sharenfs='rw=@123.123.0.0/16:[::1],root=neo' tank/home
pro tip from the page itself, no cap: if you're using DNS for host name resolution, specify the fully-qualified hostname. don't be vague about it, bestie. ๐
Example 17: Delegating ZFS Administration Permissions on a ZFS Dataset ๐
okay so you don't have to do EVERYTHING yourself โ you can hand out powers. this sets it up so user cindys can create, destroy, mount, and take snapshots on tank/cindys:
# zfs allow cindys create,destroy,mount,snapshot tank/cindys
# zfs allow tank/cindys
---- Permissions on tank/cindys --------------------------------------
Local+Descendent permissions:
user cindys create,destroy,mount,snapshot
and then the lil plot twist ๐ซ โ because the tank/cindys mount point permission is set to 755 by default, user cindys will be unable to mount file systems under tank/cindys. rude, honestly. to fix it, add an ACE like this to give mount point access:
# chmod A+user:cindys:add_subdirectory:allow /tank/cindys
fixed. slay. ๐
Example 18: Delegating Create Time Permissions on a ZFS Dataset โจ
this one lets anyone in the group staff create file systems in tank/users. and the cute part? this syntax also lets staff members destroy their own file systems โ but not anyone else's. boundaries, bestie. we love them:
# zfs allow staff create,mount tank/users
# zfs allow -c destroy tank/users
# zfs allow tank/users
---- Permissions on tank/users ---------------------------------------
Permission sets:
destroy
Local+Descendent permissions:
group staff create,mount
see the -c? that's what makes destroy a create-time permission. so the destroy power only applies to stuff they make themselves. fair and balanced. โ๏ธ
Example 19: Defining and Granting a Permission Set on a ZFS Dataset ๐
why type out a whole list of permissions every time when you can bundle them into a named set? define once, grant everywhere:
# zfs allow -s @pset create,destroy,snapshot,mount tank/users
# zfs allow staff @pset tank/users
# zfs allow tank/users
---- Permissions on tank/users ---------------------------------------
Permission sets:
@pset create,destroy,mount,snapshot
Local+Descendent permissions:
group staff @pset
@pset is the lil permission bundle, and staff just gets handed the whole thing. efficiency queen behavior. ๐
Example 20: Delegating Property Permissions on a ZFS Dataset ๐ธ
this one grants the ability to set quota and reservation on the users/home file system. so cindys can manage her own space without needing the big boss:
# zfs allow cindys quota,reservation users/home
# zfs allow users/home
---- Permissions on users/home ---------------------------------------
Local+Descendent permissions:
user cindys quota,reservation
cindys% zfs set quota=10G users/home/marks
cindys% zfs get quota users/home/marks
NAME PROPERTY VALUE SOURCE
users/home/marks quota 10G local
see how cindys% (that's her, doing her own thing) sets a quota and then reads it right back? and SOURCE says local because she set it. autonomy. we stan. ๐ซถ
Example 21: Removing ZFS Delegated Permissions on a ZFS Dataset ๐
sometimes you gotta take the power back. this removes the snapshot permission from the staff group on the tank/users file system:
# zfs unallow staff snapshot tank/users
# zfs allow tank/users
---- Permissions on tank/users ---------------------------------------
Permission sets:
@pset create,destroy,mount,snapshot
Local+Descendent permissions:
group staff @pset
notice how staff still has @pset โ the direct snapshot grant is what got yanked. and @pset still holds its own create,destroy,mount,snapshot, so read carefully, bestie. unallow targets exactly what you point it at. no more, no less. ๐
๐ Example 22: Showing the differences between a snapshot and a ZFS Dataset ๐
The following example shows how to see what has changed between a prior snapshot of a ZFS dataset and its current state. The -F option is used to indicate type information for the files affected.
# zfs diff -F tank/test@before tank/test
M / /tank/test/
M F /tank/test/linked (+1)
R F /tank/test/oldname -> /tank/test/newname
- F /tank/test/deleted
+ F /tank/test/created
M F /tank/test/modified
โจ Example 23: Creating a bookmark โจ
The following example creates a bookmark to a snapshot. This bookmark can then be used instead of a snapshot in send streams.
# zfs bookmark rpool@snapshot rpool#bookmark
๐ Example 24: Setting sharesmb Property Options on a ZFS File System ๐
The following example shows how to share an SMB filesystem through ZFS. Note that a user and their password must be given.
# smbmount //127.0.0.1/share_tmp /mnt/tmp -o
user=workgroup/turbo,password=obrut,uid=1000
Minimal /etc/samba/smb.conf configuration is required, as follows.
Samba will need to bind to the loopback interface for the ZFS utilities to communicate with Samba. This is the default behavior for most Linux distributions.
Samba must be able to authenticate a user. This can be done in a number of ways (passwd(5), LDAP, smbpasswd(5), &c.). How to do this is outside the scope of this document โ refer to smb.conf(5) for more information.
See the โUSERSHARESโ section for all configuration options, in case you need to modify any options of the share afterwards. Do note that any changes done with the net(8) command will be undone if the share is ever unshared (like via a reboot).
๐ ENVIRONMENT VARIABLES ๐
ZFS_COLORโ Use ANSI color inzfs diffandzfs listoutput.ZFS_MOUNT_HELPERโ Causezfs mountto usemount(8)to mount ZFS datasets. This option is provided for backwards compatibility with older ZFS versions.ZFS_SET_PIPE_MAXโ Tellszfsto set the maximum pipe size for sends/receives. Disabled by default on Linux due to an unfixed deadlock in Linux's pipe size handling code.ZFS_MODULE_TIMEOUTโ Time, in seconds, to wait for/dev/zfsto appear. Defaults to10, max600(10 minutes). If<0, wait forever; if0, don't wait.
๐ INTERFACE STABILITY ๐
Committed.
๐ฆ SEE ALSO ๐ฆ
attr(1), gzip(1), ssh(1), chmod(2), fsync(2), stat(2), write(2), acl(5), attributes(5), exports(5), zfsconcepts(7), zfsprops(7), exportfs(8), mount(8), net(8), selinux(8), zfs-allow(8), zfs-bookmark(8), zfs-change-key(8), zfs-clone(8), zfs-create(8), zfs-destroy(8), zfs-diff(8), zfs-get(8), zfs-groupspace(8), zfs-hold(8), zfs-inherit(8), zfs-jail(8), zfs-list(8), zfs-load-key(8), zfs-mount(8), zfs-program(8), zfs-project(8), zfs-projectspace(8), zfs-promote(8), zfs-receive(8), zfs-redact(8), zfs-release(8), zfs-rename(8), zfs-rollback(8), zfs-send(8), zfs-set(8), zfs-share(8), zfs-snapshot(8), zfs-unallow(8), zfs-unjail(8), zfs-unload-key(8), zfs-unmount(8), zfs-unshare(8), zfs-upgrade(8), zfs-userspace(8), zfs-wait(8), zpool(8).
๐ And that's a wrap, bestie! This page is brought to you by OpenZFS and it's dated May 12, 2025. Slay. ๐ โจ
๐ฆ where this page comes from
- alpine 3.23: zfs-doc 2.4.4-r0 ยท CDDL-1.0
- alpine 3.24: zfs-doc 2.4.4-r0 ยท CDDL-1.0
- nixos 26.05: zfs-user 2.4.4
- nixpkgs unstable: zfs-user 2.4.4
- ubuntu resolute: zfsutils-linux 2.4.1-1ubuntu5 ยท CDDL-1.0
- ubuntu resolute: zfsutils-linux 2.4.1-1ubuntu5.1 ยท CDDL-1.0
- ubuntu stonking: zfsutils-linux 2.4.4-1ubuntu4 ยท CDDL-1.0
- ๐ the page's license: CDDL-1.0
- Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved
- Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
- Copyright (c) 2011, 2019 by Delphix. All rights reserved
- Copyright (c) 2011, Pawel Jakub Dawidek <pjd@FreeBSD.org>
- Copyright (c) 2012, Glen Barber <gjb@FreeBSD.org>
- Copyright (c) 2012, Bryan Drewery <bdrewery@FreeBSD.org>
- Copyright (c) 2013, Steven Hartland <smh@FreeBSD.org>
- Copyright (c) 2013 by Saso Kiselkov. All rights reserved
- Copyright (c) 2014, Joyent, Inc. All rights reserved
- Copyright (c) 2014 by Adam Stevko. All rights reserved
- Copyright (c) 2014 Integros [integros.com]
- Copyright (c) 2014, Xin LI <delphij@FreeBSD.org>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms