ZFS-REWRITE(8)

πŸ“¦
version 2.4.4 Β· 3 versions
, in alpine 3.23, alpine 3.24, nixos 26.05, nixpkgs unstable, ubuntu resolute, ubuntu stonking

✨ zfs-rewrite πŸ’…

okay bestie, welcome to zfs-rewrite β€” that's the manual page for the zfs rewrite command in the System Manager's Manual section. She's here to rewrite your files without changing a single byte of them and honestly? iconic behavior. πŸŽ€


🌸 NAME 🌸

zfs-rewrite β€” rewrite specified files without modification. no cap, the data stays exactly the same, it just gets a whole new lease on life. ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

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

πŸ’– DESCRIPTION πŸ’–

So here's the tea: this command rewrites blocks of the file you point at as is, without modification, but at a new location, and possibly with new properties β€” like, imagine the file got atomically read and written back. glow up but make it byte-identical. 🫢

if you wanna know which properties can actually get applied during a rewrite, go read the β€œNOTES” section below, it's all in there. πŸ‘‡

πŸŽ€ OPTIONS πŸŽ€

  • -P β€” perform a physical rewrite, preserving the logical birth time of blocks. by default, rewrite updates logical birth times, which makes blocks look modified in snapshots and incremental send streams. a physical rewrite keeps those logical birth times intact, so you avoid unnecessary inclusion in incremental streams. ⚠️ heads up though: physical rewrite requires the physical_rewrite feature to be enabled on the pool β€” no feature, no rewrite, periodt.
  • -l length β€” rewrite at most this number of bytes. that's it, that's the whole vibe. πŸ“
  • -o offset β€” start at this offset in bytes. like, where do we begin, bestie? πŸ“
  • -r β€” recurse into directories. go down the whole tree, main character energy. 🌳
  • -v β€” print the names of all successfully rewritten files. very "let me announce every W out loud". πŸ—£οΈ
  • -x β€” don't cross file system mount points when recursing. stay in your lane (affectionate). 🚧

πŸ”₯ NOTES πŸ”₯

okay this is the part you actually need, so like, pay attention. πŸ‘‘

rewrite works by replacing an existing block with a new block of the same logical size. changed dataset properties that operate on the data or metadata without changing the logical size will be applied. that includes:

  • checksum
  • compression
  • dedup
  • copies

but bestie… changes to properties that affect the size of a logical block, like recordsize, will have no effect. she said no. πŸ’€

rewrite of cloned blocks and blocks that are part of any snapshots β€” same as some property changes β€” may increase pool space usage. keep an eye on that. πŸ‘€

also: holes that were never written, or were previously zero-compressed, are not rewritten and will remain holes even if compression is disabled. a hole is a hole is a hole. πŸ•³οΈβœ¨

and this one's lowkey important: if a -l or -o value requests a rewrite to regions past the end of the file, then those regions are silently ignored, and no error is reported. she just… doesn't mention it. πŸ™ˆ

by default, rewritten blocks update their logical birth time, meaning they'll be included in incremental zfs send streams as modified data. when you use the -P flag though, rewritten blocks preserve their logical birth time, since there are no user data changes. slay. πŸ’…


🌈 SEE ALSO 🌈


and that's the whole page, bestie!! πŸ₯³ this was brought to you by OpenZFS, dated November 5, 2025 β€” go rewrite something, you absolute icon. πŸ’œπŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from