← Back to context

Comment by doublepg23

1 day ago

only HDD drives I use are in a ZFS pool which has a very usable fragmentation value from zpool.

In case you (or others aren’t aware) the FRAG value ZFS shows, is an arbitrary calculation to help give a value to free space fragmentation.

The purpose is to have a sense of when ZFS may developing trouble quickly finding contiguous blocks of free space to dump new data into. Mostly only a concern for high active and highly full pools. When you start watching the number climb past double digits, you may start finding performance issues but it’s a very contextual thing, rather than “at x value it’s bad”.

Basically it has nothing to do with written file fragmentation, or potential read speed.

Because ZFS is a copy on write filsystem, attempts at defragmentation an active pool are generally not effective. An exception would be a pool that is full of large files that was written in a non contiguous way (like torrents), in which case copying the data to a new dataset and deleting the old roughly achieves the purpose. Or you could use something like https://github.com/salesforce/zfs_defrag

  • Wow! I did not know that, thank you for the info.

    Indeed torrents were the most obvious cause of the fragmentation I saw.