xref: /freebsd/sys/contrib/openzfs/man/man8/zfs-rewrite.8 (revision b1c1ee4429fcca8f69873a8be66184e68e1b19d7)
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 rvx 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 l Ar length
47Rewrite at most this number of bytes.
48.It Fl o Ar offset
49Start at this offset in bytes.
50.It Fl r
51Recurse into directories.
52.It Fl v
53Print names of all successfully rewritten files.
54.It Fl x
55Don't cross file system mount points when recursing.
56.El
57.Sh NOTES
58Rewrite of cloned blocks and blocks that are part of any snapshots,
59same as some property changes may increase pool space usage.
60Holes that were never written or were previously zero-compressed are
61not rewritten and will remain holes even if compression is disabled.
62.Pp
63Rewritten blocks will be seen as modified in next snapshot and as such
64included into the incremental
65.Nm zfs Cm send
66stream.
67.Pp
68If a
69.Fl l
70or
71.Fl o
72value request a rewrite to regions past the end of the file, then those
73regions are silently ignored, and no error is reported.
74.
75.Sh SEE ALSO
76.Xr zfsprops 7
77