Find ZFS record sizes per dataset

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

Tinkerer

Member
Sep 5, 2020
83
28
18
Now that my new U.2 SSD's are operational I added them as a mirror to my 4-mirror spinning rust pool as a special vdev for metadata and small blocks. For the moment I set it to 64k.

Ideally, I would like to figure out the current block sizes per dataset so I can set recordsize to the best value for the current data.

Once set, I can rebalance (copy back and forth and remove old or use a 2nd pool of spare disks).

I found this thread over here that discusses special vdev and block sizes, but I don't quite understand how to interpret the results.

Basically, I can run the command in a mounted dataset:
Code:
find . -type f -print0 | xargs -0 ls -l | awk '{ n=int(log($5)/log(2)); if (n<10) { n=10; } size[n]++ } END { for (i in size) printf("%d %d\n", 2^i, size[i]) }' | sort -n | awk 'function human(x) { x[1]/=1024; if (x[1]>=1024) { x[2]++; human(x) } } { a[1]=$1; a[2]=0; human(a); printf("%3d%s: %6d\n", a[1],substr("kMGTEPYZ",a[2]+1,1),$2) }'
In one particular dataset I got this:
Code:
  1G:      3
  4G:      2
 64G:      1
128G:      6
And well, I don't know what I am looking at.

Edit:
Nevermind, it just dawned on me the output the the number of files in the size range. I got thrown off because Im thinking block and record sizes and that output wasn't making sense to me ...
 
Last edited: