According to the mount man page,
Access time is only updated if the previous access time was earlier than the current modify or change time.
However if I do this (ext4 with relatime option(*)):
> date +%T.%N ; dd if=/dev/random of=random.dat bs=1 count=4096 ; date +%T.%N ; stat random.dat
18:52:00.616084761
4096+0 records in
4096+0 records out
4096 bytes (4.1 kB, 4.0 KiB) copied, 0.0319383 s, 128 kB/s
18:52:00.651183318
File: random.dat
Size: 4096 Blocks: 8 IO Block: 4096 regular file
Device: fd01h/64769d Inode: 28313073 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/ me) Gid: ( 1000/ me)
Access: 2022-09-26 18:52:00.616297607 +0200
Modify: 2022-09-26 18:52:00.648297639 +0200
Change: 2022-09-26 18:52:00.648297639 +0200
Birth: -
The access time seems to be stuck to the creation time, and if I rerun it (so now random.dat exists, and it is the same inode that is updated) I get:
> date +%T.%N ; dd if=/dev/random of=random.dat bs=1 count=4096 ; date +%T.%N ; stat random.dat
18:52:43.014712313
4096+0 records in
4096+0 records out
4096 bytes (4.1 kB, 4.0 KiB) copied, 0.0633748 s, 64.6 kB/s
18:52:43.081174320
File: random.dat
Size: 4096 Blocks: 8 IO Block: 4096 regular file
Device: fd01h/64769d Inode: 28313073 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/ me) Gid: ( 1000/ me)
Access: 2022-09-26 18:52:00.616297607 +0200
Modify: 2022-09-26 18:52:43.076338407 +0200
Change: 2022-09-26 18:52:43.076338407 +0200
Birth: -
... where the access time hasn't changed at all despite a complete rewrite of the file contents.
What am I missing/misunderstanding? Shouldn't the access time be updated together with the modify and change ones?
(*) /dev/mapper/vgkubuntu-root on / type ext4 (rw,relatime,errors=remount-ro)
(**) Use of dd if=/dev/random for demo purposes (slow output)
cat filename > /dev/null.date(even if there is no timestamp defined for it in ext4). Alsoaccessincludesread, but what else? (otherwise why isn't it namedread?).mmap(2)accesses the file and isn'tread(2)atime.