傳統 Unix/Linux 檔案系統 (ext2/3/4、XFS、Btrfs 早期版本) **不記錄檔案建立時間**。僅保留三個時間戳:
cat, more, grep)。ls, stat **不更新** atime。vi 存檔、echo >> file)。ls -l 顯示的即為 mtime。chmod、擁有者 chown、連結數變更、移動檔案)。**非內容變更**。以上皆為推測,**無法保證**。
[user@host ~]$ stat test.txt File: 'test.txt' Size: 66 Blocks: 8 IO Block: 4096 regular file Device: 807h/2055d Inode: 1191481 Links: 1 Access: (0664/-rw-rw-r--) Uid: ( 500/user) Gid: ( 500/user) Access: 2024-05-20 10:30:00.000000000 +0800 # atime Modify: 2024-05-20 10:25:00.000000000 +0800 # mtime Change: 2024-05-20 10:25:00.000000000 +0800 # ctime Birth: - # ext4 未啟用 birth time 顯示 '-'
| 檔案系統 | 核心版本 | 支援狀態 | 查看方式 |
|---|---|---|---|
| ext4 | 4.11+ | 支援 (需 debugfs 或 statx 系統呼叫) | debugfs -R 'stat /path/file' /dev/sdX 觀察 crtime |
| Btrfs | 4.1+ | 原生支援 | stat (glibc 2.28+)、btrfs inspect-internal rootid |
| XFS | 5.10+ | 支援 (v5 超級區塊) | stat、xfs_db |
| ZFS (OpenZFS) | - | 原生支援 | zfs get creation |
noatime、relatime 可減少 atime 更新 I/O,提升效能。touch -a 僅更新 atime,touch -m 僅更新 mtime,touch 同時更新 atime/mtime (ctime 亦會更新)。