ZFS fragmentation


New Member

Messages: 13

Anyone know how to defrag a ZFS pool? In about 6 months of working, speed with pool decreased by 5 times. I use copy from one pool to another for defragmentation by now. But it's a bad method because it needs to free some TB of HDD space.


Well-Known Member

Reaction score: 100
Messages: 369

The following was posted as a reply to the question "Is it possible to defragment a zfs pool?"
phoenix said:
Not currently. The "block pointer rewrite" feature is what's needed for this (online defragmenting) and a host of other features (migrating between vdev types, removing vdevs from the pool, etc).

It's under development and people are actively working on it, but it's not yet available as part of any ZFS release.


Well-Known Member

Reaction score: 72
Messages: 403

Try to keep your pool usage below 80% for decent performance. It's in the ZFS Best Practices guide:

Keep pool space under 80% utilization to maintain pool performance. Currently, pool performance can degrade when a pool is very full and file systems are updated frequently, such as on a busy mail server. Full pools might cause a performance penalty, but no other issues. If the primary workload is immutable files (write once, never remove), then you can keep a pool in the 95-98% utilization range. Keep in mind that even with mostly static content in the 95-98% range, write, read, and resilvering performance might suffer.


Active Member

Reaction score: 2
Messages: 136

Oh oh, memories of vms disks defragmentation ;)
That was first disk to tape, 2nd on 1st, 3rd on 2nd, 4th ... then 1st to 2nd and tape to first.
Took all the night !