zfs-rename — rename ZFS dataset
Contents
Description
zfsrename [-f] filesystem|volume|snapshotfilesystem|volume|snapshotzfsrename-p [-f] filesystem|volumefilesystem|volumezfsrename-u [-f] filesystemfilesystem
Renames the given dataset. The new target can be located anywhere in the ZFS hierarchy, with the
exception of snapshots. Snapshots can only be renamed within the parent file system or volume. When
renaming a snapshot, the parent file system of the snapshot does not need to be specified as part of
the second argument. Renamed file systems can inherit new mount points, in which case they are
unmounted and remounted at the new mount point.
-f Force unmount any file systems that need to be unmounted in the process. This flag has no effect
if used together with the -u flag.
-p Creates all the nonexistent parent datasets. Datasets created in this manner are automatically
mounted according to the mountpoint property inherited from their parent.
-u Do not remount file systems during rename. If a file system's mountpoint property is set to legacy
or none, the file system is not unmounted even if this option is not given.
zfsrename-rsnapshotsnapshot
Recursively rename the snapshots of all descendent datasets. Snapshots are the only dataset that can
be renamed recursively.
Examples
Example1: 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:
# zfscreatepool/project/production
populate /pool/project/production with data
# zfssnapshotpool/project/production@today
# zfsclonepool/project/production@todaypool/project/beta
make changes to /pool/project/beta and test them
# zfspromotepool/project/beta
# zfsrenamepool/project/productionpool/project/legacy
# zfsrenamepool/project/betapool/project/production
once the legacy version is no longer needed, it can be destroyed
# zfsdestroypool/project/legacyExample2: 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:
# zfsdestroy-rpool/users@7daysago
# zfsrename-rpool/users@6daysago @7daysago
# zfsrename-rpool/users@5daysago @6daysago
# zfsrename-rpool/users@4daysago @5daysago
# zfsrename-rpool/users@3daysago @4daysago
# zfsrename-rpool/users@2daysago @3daysago
# zfsrename-rpool/users@yesterday @2daysago
# zfsrename-rpool/users@today @yesterday
# zfssnapshot-rpool/users@today
OpenZFS March 16, 2022 ZFS-RENAME(8)
Name
zfs-rename — rename ZFS dataset
Synopsis
zfsrename [-f] filesystem|volume|snapshotfilesystem|volume|snapshotzfsrename-p [-f] filesystem|volumefilesystem|volumezfsrename-u [-f] filesystemfilesystemzfsrename-rsnapshotsnapshot
