Linux Kernel – Is There a Way to Get File Creation Date?

filesystemsstat

For a long time, Linux hasn't bothered with file creation dates because none of the file systems it commonly used supported them. However now, 2 file systems commonly used (NTFS and ext4) both record file creation dates.

The stat command, however, still outputs Birth: - on an ext4 file system, even though we can see that ext4 has stored the file's create date using debugfs -R 'stat <inode_number>' /dev/file_device.

When I looked into why this is, I saw that someone else has already recently filed a bug report on it, and the response links through to an upstream issue that simply states "there is no Linux kernel interface at present to get that info [file creation date]". It seems remarkable to me that this is apparently still the case, as people have been requesting that stat display this info for years (and stat does output a Birth field, even though it apparently doesn't support it yet! Did they add it in anticipation?)

So is it still true that there is no Linux kernel interface at present to get file creation date? Is there a plan to implement this ever?

Best Answer

EDIT: Good news, statx() has been merged so it should be available in release 4.11.


xstat() work, currently statx(), was revised in 2016.

The process was a bit more disciplined this time (less bikeshedding, agreement to drop controversial attributes as they can always be added later). Unfortunately there were still objections to the exact interface and I haven't seen any more recent references.

Related Question