Skip to main content
  1. 2021/
  2. September/

Relocating ZFS Datasets

·2 mins

Relocating ZFS Datasets #

I was hoping to figure out the best way to do this.

zfs rename -p Wolfspyre/Ivy/Art Wolfspyre/Shares/Art root@pine:/mnt/Wolfspyre# tree -d -L 2 Ivy/

Ivy/
β”œβ”€β”€ Art
β”œβ”€β”€ Backup
β”‚Β Β  └── InfrastructureShares
β”œβ”€β”€ Documentation
β”œβ”€β”€ Drivers
β”œβ”€β”€ Git
β”œβ”€β”€ Media
β”œβ”€β”€ MusicStore
β”œβ”€β”€ OSImages
β”œβ”€β”€ Pandashare
β”œβ”€β”€ Repo
β”œβ”€β”€ Share
β”œβ”€β”€ Software
β”œβ”€β”€ Store
β”œβ”€β”€ VMStorage
β”œβ”€β”€ Walle
β”œβ”€β”€ homedirs
β”œβ”€β”€ iTunes
β”œβ”€β”€ k8s_pvc_store
β”œβ”€β”€ proxmox_storage
└── tftproot

zfs rename -p Wolfspyre/Ivy/Art Wolfspyre/Shares/Art zfs rename -p Wolfspyre/Ivy/Backup/InfrastructureShares Wolfspyre/Shares/Infrastructure


ZFS Rename Manpage #

ZFS-RENAME(8) BSD System Manager’s Manual ZFS-RENAME(8) #
NAME #

zfs-rename β€” rename ZFS dataset

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
DESCRIPTION #
zfs rename [-f] filesystem|volume|snapshot filesystem|volume|snapshot
zfs rename -p [-f] filesystem|volume filesystem|volume
zfs rename -u [-f] filesystem filesystem

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.

zfs rename -r snapshot snapshot: Recursively rename the snapshots of all descendent datasets. Snapshots are the only dataset that can be renamed recursively.