zfs-rewrite.8

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

zfs-rewriterewrite specified files without modification

zfs rewrite [-Prvx] [-l length] [-o offset] file|directory

Rewrite blocks of specified file as is without modification at a new location and possibly with new properties, such as checksum, compression, dedup, copies, etc, as if they were atomically read and written back.

Perform physical rewrite, preserving logical birth time of blocks. By default, rewrite updates logical birth times, making blocks appear as modified in snapshots and incremental send streams. Physical rewrite preserves logical birth times, avoiding unnecessary inclusion in incremental streams. Physical rewrite requires the feature to be enabled on the pool.
length
Rewrite at most this number of bytes.
offset
Start at this offset in bytes.
Recurse into directories.
Print names of all successfully rewritten files.
Don't cross file system mount points when recursing.

Rewrite of cloned blocks and blocks that are part of any snapshots, same as some property changes may increase pool space usage. Holes that were never written or were previously zero-compressed are not rewritten and will remain holes even if compression is disabled.

If a -l or -o value request a rewrite to regions past the end of the file, then those regions are silently ignored, and no error is reported.

By default, rewritten blocks update their logical birth time, meaning they will be included in incremental zfs send streams as modified data. When the -P flag is used, rewritten blocks preserve their logical birth time, since there are no user data changes.

zfsprops(7), zpool-features(7)

May 6, 2025 Debian