ZFS Commands Cheat Sheet
ZFS File System Management
Efficiently manage your ZFS file systems with these essential commands. Learn how to list, create, configure, and remove file systems to suit your storage needs.
Command | Description |
---|---|
zfs list |
List ZFS file systems and their properties. |
zfs create <pool>/<filesystem> |
Create a new ZFS file system within a specified pool. |
zfs set <property>=<value> <pool>/<filesystem> |
Set or modify ZFS file system properties (e.g., compression, quotas). |
zfs get <property> <pool>/<filesystem> |
Retrieve the value of a specific ZFS file system property. |
zfs destroy <pool>/<filesystem> |
Permanently delete a ZFS file system and all its contents. |
ZFS Pool Management
Understand and control your ZFS storage pools. This section covers commands for listing, creating, destroying, and monitoring the health and performance of your ZFS pools.
Command | Description |
---|---|
zpool list |
Display a list of all ZFS storage pools and their status. |
zpool create <pool> <device> |
Create a new ZFS storage pool using one or more devices. |
zpool destroy <pool> |
Completely remove a ZFS storage pool and all its data. Use with extreme caution. |
zpool iostat |
Show real-time I/O statistics for ZFS pools, helping to identify performance bottlenecks. |
zpool status |
Check the health and integrity of your ZFS pools, reporting on device status and errors. |
zpool history |
View a log of all ZFS pool administration commands executed. |
zpool events |
Display recent events and alerts related to ZFS pool operations. |
zpool scrub <pool> |
Initiate a data integrity scrub on a ZFS pool to detect and repair errors. |
zpool clear <pool> |
Clear persistent error states from a ZFS pool. |
zpool trim <pool> |
Perform a TRIM operation on supported devices within a ZFS pool for performance optimization. |
zpool add <pool> <device> |
Add a new device to an existing ZFS pool, potentially expanding its capacity or redundancy. |
zpool remove <pool> <device> |
Remove a device from a ZFS pool. This is typically done before replacing a failing drive. |
zpool replace <pool> <device> |
Replace an existing device in a ZFS pool with a new one. |
zpool offline <pool> <device> |
Mark a device within a ZFS pool as offline, often done before maintenance or replacement. |
ZFS Snapshots
Leverage ZFS snapshots for powerful data protection and versioning. This section details commands for creating, managing, rolling back, and replicating snapshots.
Command | Description |
---|---|
zfs list -t snapshot |
List all ZFS snapshots across your file systems. |
zfs snapshot <pool>/<filesystem>@<snapshot> |
Create a point-in-time snapshot of a ZFS file system. |
zfs rollback <pool>/<filesystem>@<snapshot> |
Revert a ZFS file system to the state of a specific snapshot. |
zfs diff <pool>/<filesystem>@<snapshot_1> <pool>/<filesystem>@<snapshot_2> |
Compare two ZFS snapshots to see the differences between them. |
zfs send <pool>/<filesystem>@<snapshot> |
Generate a stream of data representing a ZFS snapshot, used for replication. |
zfs receive <pool>/<filesystem> |
Receive a ZFS snapshot stream and create a new file system or update an existing one. |
ZFS Clones
Utilize ZFS clones for efficient space-saving copies of file systems or snapshots. Explore commands for creating, promoting, and managing clones.
Command | Description |
---|---|
zfs clone <pool>/<filesystem>@<snapshot> <pool>/<filesystem> |
Create a writable clone from a ZFS snapshot. |
zfs promote <pool>/<filesystem> |
Promote a clone to become a regular file system, detaching it from its snapshot origin. |
zfs rollback <pool>/<filesystem> |
Rollback a clone to its original snapshot state. |
zfs destroy <pool>/<filesystem> |
Destroy a ZFS clone. If it's not promoted, this also destroys the snapshot it was cloned from. |
ZFS (Zettabyte File System) is a powerful, advanced file system and logical volume manager with features like data integrity protection, snapshots, copy-on-write clones, and continuous integration. This cheat sheet provides a quick reference for common ZFS commands used in DevOps and system administration for managing file systems, pools, snapshots, and clones. Understanding these commands is crucial for efficient storage management and data protection in environments leveraging ZFS.
For more in-depth information, refer to the official OpenZFS documentation and the ZFS man pages.