We begin with the xfs_db utility to view the current fragmentation status of the filesystem. The -c parameter lets us specify a command that xfs_db should invoke. In this case, we want it to check the fragmentation status, so we set -c to frag. We set the -f parameter as it allows us to use xfs_db on a mounted filesystem.
The fragmentation status is calculated by counting the number of non-contiguous extents on all files and comparing that number to the total amount of files. To prepare for this, we continuously invoked pgbench to cause a high amount of fragmentation. Here is the fragmentation on our system:
As you can see, ...