ZFS-RENAME(8)
π zfs-rename β bestie, we're renaming a ZFS dataset π
okay so this is the zfs-rename page from the System Manager's Manual β it's the part of the zfs command family that handles renaming ZFS datasets. sit down, hydrate, let's go β¨
πΈ SYNOPSIS πΈ
zfs rename [-f] filesystem|volume|snapshot filesystem|volume|snapshot
zfs rename -p [-f] filesystem|volume filesystem|volume
zfs rename -u [-f] filesystem filesystem
zfs rename -r snapshot snapshot
like, four whole shapes of the same command. pick your fighter π
π¦ DESCRIPTION π¦
zfs rename [-f] filesystem|volume|snapshot filesystem|volume|snapshot
zfs rename -p [-f] filesystem|volume filesystem|volume
zfs rename -u [-f] filesystem filesystem
so basically: this renames the dataset you give it. the new target can live anywhere in the ZFS hierarchy β with one big exception, and the exception is snapshots. snapshots can only be renamed within their parent file system or volume. and when you're renaming a snapshot, you don't have to spell out the parent file system as part of the second argument. also, renamed file systems can inherit new mount points, and if that happens they get unmounted and remounted at the new mount point. it's giving glow-up, honestly β¨
-fβ force unmount any file systems that need to be unmounted during this whole process. β οΈ heads up though: this flag has no effect if you use it together with the-uflag. they don't vibe together, fr fr.-pβ creates all the nonexistent parent datasets for you. datasets created this way get automatically mounted according to themountpointproperty they inherit from their parent. so cute, it just builds the whole family tree π«Ά-uβ do not remount file systems during rename. and lowkey a lil bonus fact: if a file system'smountpointproperty is set tolegacyornone, the file system is not unmounted even if this option is not given. so it's already chillin'. π
zfs rename -r snapshot snapshot
π the recursive one π
this recursively renames the snapshots of all descendent datasets. and ngl β snapshots are the only dataset that can be renamed recursively. that's the whole rule, no exceptions, periodt. π
β¨ EXAMPLES β¨
π Example 1: Promoting a ZFS Clone
so here's the lil routine: you test out changes to a file system, and then replace the original file system with the changed one, using clones, clone promotion, and renaming. the commands below illustrate exactly how:
# 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
the beta becomes the production, the production becomes the legacy, the legacy gets destroyed. it's giving succession arc π the main character really did that.
π§ Example 2: Performing a Rolling Snapshot
this one shows how to keep 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, like so:
# 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
everyone shuffles down one slot, the oldest leaves the group chat, and a fresh @today joins at the top. rotating the roster, slay π
also notice: in the snapshot renames here, the parent file system doesn't need to be repeated in the second argument β that's the rule from DESCRIPTION doing its thing. iykyk.
and that's the whole page bestie!! this one's from OpenZFS, dated July 11, 2022, and it lives in section 8 of the manual. go forth and rename responsibly, mwah π«Άβ¨π
π¦ 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) 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 2019 Richard Laager. All rights reserved
- Copyright 2018 Nexenta Systems, Inc
- Copyright 2019 Joyent, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms