5

I'm running Debian/Testing, with kernel 4.4:

# uname -a
Linux shaula 4.4.0-1-amd64 #1 SMP Debian 4.4.6-1 (2016-03-17) x86_64 GNU/Linux

So I want to use the lazytime mount option, which is why I put the following in my /etc/fstab:

# grep vg_crypt-root /etc/fstab 
/dev/mapper/vg_crypt-root   /   ext4   lazytime,errors=remount-ro   0   1

However, now the filesystem seems to be mounted with both relatime and lazytime:

# grep vg_crypt-root /etc/mtab 
/dev/mapper/vg_crypt-root / ext4 rw,lazytime,relatime,errors=remount-ro,data=ordered 0 0

How can this be?

6

Good news: it's expected.

The lazytime flag is independent of strictatime/relatime/noatime. And the default is relatime. So when you replaced noatime with lazytime, it's not surprising that you saw the relatime mount option being set.

-- Ted Ts'o

Unfortunately this doesn't explain what it means.

A literal reading of the manpage suggests that relatime suppresses both in-memory updates and disk writes. lazytime only suppresses disk writes (and applies to mtime as well as atime). This makes sense to me given the discussions that led to the implementation of lazytime. IOW it would be very easy to write a test for relatime. But the effect of lazytime is only visible if you look at disk writes, or test what happens with unclean shutdowns.


Personally the effect of lazytime on mtime sounds a bit odd. Maybe it's a nice optimization for systems with high uptime, but I don't know about the average desktop... And nowadays that's actually a laptop; we're not supposed to be so gung-ho about undefined or weirdly partially-defined behaviour on powerfail. It's even more special-case if you consider copy-on-write filesystems like btrfs; the "inode" is likely to be updated even when the filesize doesn't change. By contrast relatime is lovely and deterministic.

And the mtime optimization only seems to be helpful if you have writes to a large number of files which don't change their size. I'm not sure there's even a common benchmark for that. Some very non-trivial database workload, I suppose.

Seriously Ted, why didn't we get lazyatime?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.