Disabling atime in ZFS
As you remember, I decided to try ZFS on Ubuntu 20.04 last month. It’s a small server with no production load, just about powerful enough for small experiments.
Today I’m going to show you one of the performance tuning techniques for ZFS: disabling atime flag.
atime is access time, which isn’t that useful of a knowledge unless your scenario is highly specific. As you know, atime, ctime and mtime are kept for all the files - but some filesystems support an option of disabling atime, meaning that’s one operation that filesystem doesn’t need to track and therefore update on the disk when you’re accessing files (or listing directories).
In modern operating systems, there might be hundreds or thousands of files read from each filesystem - and atime flag means kernel has to update access time for each such file and commit that updated time to disk for every access operation. That’s expensive, especially when you’re accessing the same files very frequently - OS will probably cache the file contents, so that’s not going to be too I/O heavy, but would still have to update access time on disk for such access.
Disabling atime is a great way to improve I/O performance on filesystems with lots of small files that are accessed freqently.
On that Ubuntu server of mine, I have just one test zpool for now:
and it’s mounted with default options, meaning atime is not disabled for the filesystem:
If I want to check relevant option, I’ll need to run zfs command like this:
Now let’s change this atime property to off:
there will be no confirmation, so let’s re-run the zfs get all newvol command:
Excellent! Now we can confirm that this volume is automatically remounted with atime disabled:
As you can see, it now has noatime mount option activated.
Hope you found this useful.