ZFS Performance Basics: Disable atime

ZFS in Ubuntu 20.04 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.

Why disable atime?

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.

Checking atime status for a ZFS filesystem

On that Ubuntu server of mine, I have just one test zpool for now:

root@server:~ # zpool list
newvol 1.88G 281K 1.87G - - 0% 0% 1.00x ONLINE -

and it’s mounted with default options, meaning atime is not disabled for the filesystem:

root@server:~ # mount | grep newvol
newvol on /newvol type zfs (rw,xattr,noacl)

If I want to check relevant option, I’ll need to run zfs command like this:

root@server:~ # zfs get all newvol | grep time
newvol atime on local
newvol relatime off default

Disabling atime for ZFS

Now let’s change this atime property to off:

root@server:~ # zfs set atime=off newvol

there will be no confirmation, so let’s re-run the zfs get all newvol command:

root@server:~ # zfs get all newvol | grep time
newvol atime off local
newvol relatime off default

Excellent! Now we can confirm that this volume is automatically remounted with atime disabled:

root@server:~ # mount | grep newvol
newvol on /newvol type zfs (rw,noatime,xattr,noacl)

As you can see, it now has noatime mount option activated.

Hope you found this useful.

See Also

Contact Me

Follow me on Facebook, Twitter or Telegram:
I learn with Educative: Educative
IT Consultancy
I'm a principal consultant with Tech Stack Solutions. I help with cloud architectrure, AWS deployments and automated management of Unix/Linux infrastructure. Get in touch!
Recent Articles
24 Mar 2024

Homelab: Mac Pro 2013 32GB

30 Sep 2023

macOS Sonoma 14.0

26 Sep 2023

Video: What Browser Do You Use?

Recent Tweets