Expose zfs rewrite functionality in GUI / Add rebalance functionality

Problem/Justification
When expanding a pool with the newly added RAIDZ expansion or adding a new VDEV, the existing data is not rebalanced across the new drives. There have been lengthy discussions about this in the past and workarounds like GitHub - markusressel/zfs-inplace-rebalancing: Simple bash script to rebalance pool data between all mirrors when adding vdevs to a pool. .

I am aware that there already has been a feature request regarding this functionality being added to TrueNAS: [Not Accepted] Add full rebalance feature in the GUI
This feature request was not accepted because iX will (understandably) not implement the underlying functionality in userspace, it “would have to be implemented transparently in ZFS”.

This has now happened.

In one of the recent TrueNAS Tech Talks, the new “zfs rewrite” subcommand whose development was sponsored by iX was presented. https://www.youtube.com/watch?v=NcZ2zj1Ricc&t=1538s
With Introduce zfs rewrite subcommand by amotin · Pull Request #17246 · openzfs/zfs · GitHub being accepted and merged into master, it will likely be available in the next (or one of the next) ZFS release.

This feature request is for exposing the functionality of the new “zfs rewrite” subcommand in a user-friendly way in the TrueNAS GUI - e.g. the user being asked after a RAIDZ expansion if he wants to rebalance the pool or the rebalance task showing up in the task manager with a progress bar so the user doesn’t have to rely on the ZFS CLI.

Impact
Advantages:

  • An official ZFS feature is exposed in a user-friendly way through the TrueNAS GUI, so the user doesn’t have to rely on the ZFS CLI
  • The GUI can provide guardrails, hints and limitations regarding this functionality that a user using the CLI would not get, e.g. Snapshots becoming independent copies as discussed in ELI5: ZFS "rewrite"
  • TrueNAS can orchestrate / coordinate this functionality with other functionalities managed by TrueNAS - e.g. maybe scrubbing should be paused during rebalancing, as discussed here for scrubbing during RAIDZ expansion Enhance the user experience during RAIDZ expansion
  • A long awaited and heavily discussed feature whose solution relied on “hacky workarounds” is finally officially available in TrueNAS

Disadvantages:

  • None that I can think of

User Story
As a NAS owner with TrueNAS installed that has some free drive bays, I want to add one or more new drives to my existing RAIDZ pool to have more storage available. After addition of the new drives, I want my existing data to be evenly balanced across all drives.

As far as i can remember from the t3 podcast the zfs rewrite is mainly developed by iX and will be included in truenas, but propably in the fall release in october.

Edit:
Minute 25:37

Edit2:
Ok at the end of the podcast they mention that it will propably be 2026 before it’ll land in truenas.

I would expect that to come naturally, but at its pace.