ZFS-SNAPSHOT(8) System Manager's Manual ZFS-SNAPSHOT(8)

# [NAME](#NAME)

`zfs-snapshot` — create snapshots of ZFS datasets

# [SYNOPSIS](#SYNOPSIS)

`zfs` `snapshot` \[`-r`] \[`-o` `property`=`value`]… `dataset`@`snapname`…

# [DESCRIPTION](#DESCRIPTION)

Creates a snapshot of a dataset or multiple snapshots of different datasets.

Snapshots are created atomically. That is, a snapshot is a consistent image of a dataset at a specific point in time; it includes all modifications to the dataset made by system calls that have successfully completed before that point in time. Recursive snapshots created through the `-r` option are all created at the same time.

`zfs` `snap` can be used as an alias for `zfs` `snapshot`.

See the [Snapshots](#Snapshots) section of [zfsconcepts(7)](/man/os/zfs/zfsconcepts.7) for details.

[`-o`](#o) `property`=`value`

Set the specified property; see `zfs` `create` for details.

[`-r`](#r)

Recursively create snapshots of all descendent datasets

# [EXAMPLES](#EXAMPLES)

## [Example 1: Creating a ZFS Snapshot](#Example_1_:_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 2: Creating and Destroying Multiple Snapshots](#Example_2_:_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.

`# zfs snapshot -r pool/home@yesterday`

`# zfs destroy -r pool/home@yesterday`

## [Example 3: Promoting a ZFS Clone](#Example_3_:_Promoting_a_ZFS_Clone)

The following commands illustrate how to test out changes to a file system, and then replace the original file system with the changed one, using clones, clone promotion, and renaming:

```
# 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
```

## [Example 4: Performing a Rolling Snapshot](#Example_4_:_Performing_a_Rolling_Snapshot)

The following example shows how to maintain a history of snapshots with a consistent naming scheme. To keep a week's worth of snapshots, the user destroys the oldest snapshot, renames the remaining snapshots, and then creates a new snapshot, as follows:

```
# 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 ALSO](#SEE_ALSO)

[zfs-bookmark(8)](/man/os/zfs/zfs-bookmark.8), [zfs-clone(8)](/man/os/zfs/zfs-clone.8), [zfs-destroy(8)](/man/os/zfs/zfs-destroy.8), [zfs-diff(8)](/man/os/zfs/zfs-diff.8), [zfs-hold(8)](/man/os/zfs/zfs-hold.8), [zfs-rename(8)](/man/os/zfs/zfs-rename.8), [zfs-rollback(8)](/man/os/zfs/zfs-rollback.8), [zfs-send(8)](/man/os/zfs/zfs-send.8)

July 11, 2022 OpenZFS

---

Document: zfs-snapshot(8) from zfs 2.4.4-r3 (Chainguard OS)
Source: https://github.com/openzfs/zfs
