-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Describe the feature you would like to see added to OpenZFS
Add a command or flag to rewrite existing data in-place when compression or checksum properties are changed, allowing datasets to be fully migrated to new algorithms without manual workarounds.
Proposed syntax:
zfs rewrite pool/dataset
Or as a flag:
zfs set -o rewrite checksum=sha256 pool/dataset
This would traverse the dataset and rewrite blocks with the new compression/checksum algorithms while preserving all metadata, timestamps, permissions, and attributes.
How will this feature improve OpenZFS?
Problem: Changing checksum from fletcher4 to sha256 (for example NOOPwrite) or changing compression algorithms only affects new writes. Existing data remains in the old format indefinitely unless manually rewritten.
Benefits:
- Enable NOOPwrite on existing datasets (fletcher4→sha256 migration)
- Migrate to better compression algorithms (lz4→zstd) without space penalties
- Improve data integrity by upgrading to stronger checksums
- Single command instead of complex workarounds
Similar features:
- btrfs:
btrfs balancefor compression migration - bcachefs: automatic recompression on algorithm change
Additional context
Real-world scenario: I have a dataset with fletcher4 checksums and want to enable NOOPwrite (requires sha256). With ~168GB of data, current options are:
- Wait indefinitely for natural rewrites
- Double my storage for send/recv
- Write custom scripts with
find | xargs | dd
A zfs rewrite command would make this trivial and safe.
Implementation considerations:
- Should be interruptible/resumable
- Progress reporting (similar to
zpool scrub) - Option to rewrite specific properties only (checksum vs compression vs both)
- Preserve refcounts for snapshots/clones
- Could be background operation like scrub/resilver
Thanks,
UD.