Direct Answer / TL;DR
atime logs reads, mtime logs data writes, ctime logs inode/metadata changes and is kernel-managed. find's -atime/-mtime/-ctime round to 24-hour periods (use -amin/-mmin/-cmin for minutes); rsync mirrors on mtime via -t/--size-only/-c and cannot preserve ctime. Diagnose with stat -c '%x %y %z' on Ubuntu 24.04, Debian 12, and RHEL 9.
stat -c '%n | a=%x | m=%y | c=%z | b=%w'
Command / Parameter Syntax Breakdown
The VFS keeps three POSIX clocks in struct inode: i_atime (raised by read(2) and mmap page faults), i_mtime (raised only by data writes and truncation), and i_ctime (raised by every inode mutation — chmod, chown, link/rename, size change, and every mtime update itself; pure atime updates never raise ctime on Linux). The folklore ‘ctime = creation time’ is wrong: birth time is a fourth, non-POSIX field, stx_btime from statx(2) (kernel 4.11+), printed by stat -c %w. Two kernel facts drive everything below: ctime can never be backdated by userspace, and reads bump atime but never mtime or ctime. Read cost is governed by mount policy: relatime (kernel default since 2.6.30) re-arms atime only when atime < mtime, atime < ctime, or the previous atime is older than 24 h; strictatime updates on every read; noatime never updates; lazytime keeps time changes dirty in RAM until an unrelated writeback, sync, memory pressure, or its 24 h timer.
# All four linux timestamps in one line (GNU coreutils stat)
stat --printf='%n a=%x m=%y c=%z b=%wn' /var/lib/clamav/daily.cvd
# Effective atime policy of the mount backing a path
findmnt -T /var/lib/clamav -no TARGET,FSTYPE,OPTIONS
# Epoch-sorted mtime report, no fork/exec cost (GNU find -printf)
find /var/lib/clamav -type f -printf '%T@ %T+ %pn' | sort -nr
Granularity matters when programs compare timestamps: ext4, XFS and btrfs keep nanoseconds; vfat has 2 s resolution for mtime and 10 ms for atime/ctime, and on FAT the exposed ‘ctime’ is synthesized from a different DOS field. Never demand sub-second timestamp equality across filesystems — rsync compensates with --modify-window=1 on FAT/SMB targets.
Flag-by-Flag Behavior & Edge Cases
stat—%x/%Xatime,%y/%Ymtime,%z/%Zctime,%w/%Wbirth time; lower-case directives are human-readable, upper-case are epoch seconds.%wprints-(and%Wprints0) where kernel or filesystem lacks birth time, e.g. tmpfs or old NFS exports. ctime (%z) is the ‘who touched this inode’ alarm: it moves onchmod,chown, hardlink/rename, truncating writes and everytouch.touch—-asets atime only,-mmtime only,-h/--no-dereferencetargets the symlink itself,-d '@1700000000'takes an epoch (GNU coreutils). Every invocation also stamps ctime to now; there is no userspace bypass.find -atime/-mtime/-ctime n— 24 h bucket semantics with floor rounding: a file modified 36 h ago matches-mtime 1and-mtime +0, but NOT-mtime +1.+nmeans ‘older than n full buckets’,-n‘younger’, barenthe exact bucket. Minute precision:-amin/-mmin/-cmin.-daystart -mtime 0means ‘since 00:00 today’.-newer REF/-newerXY(X,Y ina m c B,Y=tfor an explicit timestamp, e.g.-newermt '2025-01-01';-newerBtfor birth time) compare across clocks. find onlylstat(2)s candidates, so scanning never perturbs atime;-exec cat {} +would.rsync -t(part of-a) — activates the size+mtime quick check. Without-tthe quick check degrades to size-only, so equal-size files with wrong mtime are silently skipped.-creplaces it with whole-file checksums (reads both trees);--size-onlydrops mtime from the comparison. rsync 3.2.0+ adds-U/--atimes(Ubuntu 24.04/Debian 12 ship 3.2.7, RHEL 9 3.2.3); combine as-aUOso-O/--open-noatimestops the source read from clobbering atime (O_NOATIMEneeds ownership or CAP_FOWNER — run as root). ctime is never transported: the destination kernel stamps it on every write.relatime / strictatime / nodiratime / noatime / lazytime— the read-side mount policies.noatimeimpliesnodiratimeand is the standard choice for read-heavy services (mail spools, database files, scan targets).- ClamAV (
clamscan/clamd) is a pure read workload — one scanread()s every file, so its I/O profile is dictated by the atime policy of the scan root:strictatimecosts one metadata writeback per file,noatimenearly nothing (why mail-server guides pin maildirs onnoatime). freshclam databases in/var/lib/clamav/carry release mtimes, so timestamp-faithful rsync mirrors stay idempotent, and ‘scan only recent activity’ patterns anchor onfind -mmin.
Safe Dry-Run & Verification Workflow
- Baseline the four clocks and the effective policy;
b=%wreturns-on filesystems without birth time.$ stat --printf='%n a=%x m=%y c=%z b=%wn' /var/lib/clamav/daily.cvd /var/lib/clamav/daily.cvd a=2025-11-29 22:01:44.912 +0100 m=2025-11-26 04:12:31.000 +0100 c=2025-11-26 04:12:31.001 +0100 b=2025-11-26 04:12:30.997 +0100 $ findmnt -T /var/lib/clamav -no OPTIONS rw,relatime,errors=remount-ro - find is a dry-run whenever no action flag (
-delete,-exec) is present. Predict by bucket first:$ find /var/lib/clamav -type f -mtime +30 -printf '%T+ %pn' | sort 2024-10-02 04:12:31.000000000 +0200 /var/lib/clamav/main.cld $ find /var/spool -type f -mmin -60 -printf '%T@ %pn' | sort -nr | head 1732974222.4140000000 /var/spool/mail/alice - rsync: dry-run twice and diff the itemized output. Extra lines under
-aincare same-size, same-mtime files whose bytes differ — a mtime blind spot from clock skew, backdating or FAT 2 s granularity. The arrow shows push vs pull direction; attribute letters are lower-case in-ndry-runs and upper-case in real runs.$ rsync -ain /var/lib/clamav/ /backup/clamav/ >f+++++++++ daily.cvd $ rsync -ainc /var/lib/clamav/ /backup/clamav/ >f+++++++++ daily.cvd >fc........ main.cld - Execution plus re-verification: destination mtime must equal the source within filesystem granularity; a different ctime/btime on the copy is correct kernel behavior.
rsync -aUO /var/lib/clamav/ /backup/clamav/ find /var/spool -type f -mmin -60 -print0 | xargs -0 clamscan --infected --no-summary stat -c '%n m=%y b=%w' /var/lib/clamav/daily.cvd /backup/clamav/daily.cvd
Multi-Distro Differences
Kernel semantics are identical everywhere; packaging and toolchain versions move: the ClamAV repository (EPEL on the RHEL family), the rsync version floor for --atimes (3.2.0), and busybox’s reduced stat/find on Alpine.
Ubuntu / Debian
# coreutils 9.x (%w ok), rsync 3.2.7 (-U/-O ok)
apt-get install -y rsync clamav clamav-daemon clamav-freshclam
stat -c '%n btime=%w' /etc/hostname
findmnt -T / -no OPTIONS | tr ',' 'n' | grep -E 'atime|lazy'
# ext4 offline ctime/btime check: read-only query, root + real block device
debugfs -R 'stat /etc/hostname' /dev/mapper/vg-root 2>/dev/null | grep -E 'ctime|crtime'
RHEL / AlmaLinux / Rocky
# ClamAV from EPEL; rsync 3.2.3 still supports -U/-O
dnf install -y epel-release && dnf install -y clamav clamav-update clamd rsync
stat -c '%n btime=%w' /var/log/messages
xfs_io -c 'statx' /var/log/messages | grep -E 'ctime|btime'
findmnt -T / -no FSTYPE,OPTIONS
Arch Linux
# Newest coreutils and rsync 3.3+: full timestamp feature set
pacman -S --needed rsync clamav
stat -c '%x | %y | %z | %w' /etc/hostname
findmnt -T / -no OPTIONS | tr ',' 'n' | grep -E 'atime|lazy'
Alpine / Containers
# busybox stat lacks %w; busybox find lacks -newermt/-newerXY
apk add coreutils findutils rsync clamav clamav-freshclam
stat -c '%n btime=%w' /etc/os-release
find /var/lib/clamav -type f -mmin -60 -print
Destructive Traps & Rollback Procedure
Safety Check: timestamp filters look innocent, but timestamp-driven find (-delete, -exec rm), backdating via touch -d, and mount -o remount all carry operational blast radius. Always write a baseline file (epoch + path) under /var/tmp/*.before first — it is the only userspace rollback for atime/mtime. ctime and btime are kernel-managed and are not userspace-restorable.
Canonical retention cleanup — baseline, dry-run, execute:
# 0) baseline capture (rollback file): mtime epoch + path
find /srv/web -type f -printf '%T@ %pn' > /var/tmp/mtimes.before
# 1) dry-run: read-only candidate list; audit every line
find /srv/web -type f -mtime +30 -printf '%T+ %pn' | sort
# 2) execute only when the list above matches expectations
find /srv/web -type f -mtime +30 -delete
Rollback of a botched touch sweep restores mtime to whole seconds (add an %A@ baseline for atime; ctime/btime are gone for good):
while read -r T p; do
touch -m -d "@${T%.*}" -- "$p"
done < /var/tmp/mtimes.before
ctime/btime surgery is offline, ext-family-only, forensic-grade work — unmount the filesystem first and verify immediately with debugfs stat:
debugfs -w -R 'set_inode_field img.jpg ctime 20240101090000' /dev/mapper/vg-root
debugfs -R 'stat img.jpg' /dev/mapper/vg-root | head
Mount-policy changes are reversible: snapshot live options and re-apply them on rollback.
findmnt -T /srv -no OPTIONS > /var/tmp/mountopts.before
mount -o remount,noatime /srv
# rollback: re-apply the exact option set from /var/tmp/mountopts.before
mount -o remount,relatime /srv
Rule of thumb: find filters on linux timestamps, rsync replicates mtime and cannot set ctime, ClamAV pays the atime bill — read with stat, predict with dry-runs, and let the mount policy decide what reads cost.
Frequently Asked Edge Cases
Does running find -mtime or -atime alter the timestamps it reads?
No. find resolves each candidate with lstat(2), a metadata-only syscall that never raises atime; only read(2)/mmap access does. Pipes like `find ... -exec cat {} +` do bump atime on every listed file.
Why does rsync re-transfer files whose mtime looks identical on both sides?
The transfer ran without -t, so the quick check fell back to size-only while the receiver stamped fresh mtimes; restore with rsync -a (includes -t), add --modify-window=1 for FAT/SMB clock skew, and use -c when mtime is untrustworthy.
Can root set ctime back in time to hide edits?
No userspace call, including touch and chmod, can set ctime — the kernel stamps it on every inode mutation, so any attempt updates it to now; only offline `debugfs set_inode_field` on an unmounted ext-family filesystem can write ctime/crtime.