xref: /freebsd/sys/contrib/openzfs/man/man8/zfs-rewrite.8 (revision cb2887746f8b9dd4ad6b1e757cdc053a08b25a2e)
1.\" SPDX-License-Identifier: CDDL-1.0
2.\"
3.\" CDDL HEADER START
4.\"
5.\" The contents of this file are subject to the terms of the
6.\" Common Development and Distribution License (the "License").
7.\" You may not use this file except in compliance with the License.
8.\"
9.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10.\" or https://opensource.org/licenses/CDDL-1.0.
11.\" See the License for the specific language governing permissions
12.\" and limitations under the License.
13.\"
14.\" When distributing Covered Code, include this CDDL HEADER in each
15.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16.\" If applicable, add the following below this CDDL HEADER, with the
17.\" fields enclosed by brackets "[]" replaced with your own identifying
18.\" information: Portions Copyright [yyyy] [name of copyright owner]
19.\"
20.\" CDDL HEADER END
21.\"
22.\" Copyright (c) 2025 iXsystems, Inc.
23.\"
24.Dd May 6, 2025
25.Dt ZFS-REWRITE 8
26.Os
27.
28.Sh NAME
29.Nm zfs-rewrite
30.Nd rewrite specified files without modification
31.Sh SYNOPSIS
32.Nm zfs
33.Cm rewrite
34.Oo Fl Prvx Ns Oc
35.Op Fl l Ar length
36.Op Fl o Ar offset
37.Ar file Ns | Ns Ar directory Ns …
38.
39.Sh DESCRIPTION
40Rewrite blocks of specified
41.Ar file
42as is without modification at a new location and possibly with new
43properties, such as checksum, compression, dedup, copies, etc,
44as if they were atomically read and written back.
45.Bl -tag -width "-r"
46.It Fl P
47Perform physical rewrite, preserving logical birth time of blocks.
48By default, rewrite updates logical birth times, making blocks appear
49as modified in snapshots and incremental send streams.
50Physical rewrite preserves logical birth times, avoiding unnecessary
51inclusion in incremental streams.
52Physical rewrite requires the
53.Sy physical_rewrite
54feature to be enabled on the pool.
55.It Fl l Ar length
56Rewrite at most this number of bytes.
57.It Fl o Ar offset
58Start at this offset in bytes.
59.It Fl r
60Recurse into directories.
61.It Fl v
62Print names of all successfully rewritten files.
63.It Fl x
64Don't cross file system mount points when recursing.
65.El
66.Sh NOTES
67Rewrite of cloned blocks and blocks that are part of any snapshots,
68same as some property changes may increase pool space usage.
69Holes that were never written or were previously zero-compressed are
70not rewritten and will remain holes even if compression is disabled.
71.Pp
72If a
73.Fl l
74or
75.Fl o
76value request a rewrite to regions past the end of the file, then those
77regions are silently ignored, and no error is reported.
78.Pp
79By default, rewritten blocks update their logical birth time,
80meaning they will be included in incremental
81.Nm zfs Cm send
82streams as modified data.
83When the
84.Fl P
85flag is used, rewritten blocks preserve their logical birth time, since
86there are no user data changes.
87.
88.Sh SEE ALSO
89.Xr zfsprops 7 ,
90.Xr zpool-features 7
91