File modification time
File modification time (mtime) is the filesystem timestamp associated with the latest change to a file's contents or a directory's entries.
Writes and truncation update mtime; changing ownership or permissions alone does not. The timestamp can also be set explicitly with utimensat(), subject to permissions, without changing file contents. Filesystem resolution limits the stored value. [1] [2]
The default rsync quick check compares file size and mtime, not content. Its default comparison ignores nanoseconds; --modify-window=-1 includes them when the receiver is version 3.1.3 or later. Equal size and mtime are not proof of identical data. [3]
With lazytime, an eligible mtime change remains visible in memory even while timestamp persistence is deferred. fdatasync() may omit mtime metadata; use the required synchronization contract rather than interpreting a comparison as proof of persistence. [5] [6]
Relations
- related
- Inode, Inode change time, File access time, File birth time, Rsync quick check, Lazy timestamp persistence, Multigrain timestamps
Advantages
- Provides a low-cost signal for selecting files that may need synchronization.
Limitations
- Can be preserved or reset independently of file contents.
- Filesystem and comparison precision can hide distinct changes.
Citations
- Linux man-pages: inode(7)
- Linux man-pages: utimensat(2)
- rsync(1): file selection and modification-time comparison
- Linux mount(2): MS_LAZYTIME and timestamp policy
- Linux fsync(2): timestamp metadata and fdatasync