index | Other timestamps | Upper index

Ext4 Linux timestamps, Started 5/2/2024

Hey, did you know on some ext4 Linux "debugfs" is only way to set created at and changed at? For that, there are three ways, straight debugfs, with "-f" option for a file of commands, or with "-R" option to execute one command. You will need "-w" option to write timestamps and sudo or root. IMPORTANT, ONLY USE "debugfs" ON UNMOUNTED FILE SYSTEMS. "sif" inside debugfs with a path inside file system to use as filespec, crtime or ctime or those with "_extra" suffix are what to set, and values are dates in second precision, either YYYYmmDDHHMMSS +%Y%m%d%H%M%S year month day hour minute second or seconds since epoch in hexadecimal with "@0x" before them format, with UTC time zone to set, for main and nanos×4 for extras is how to set.


If needed:
umount /dev/sdc2
Command:
sudo debugfs -w -R "sif /home crtime 20240123000000" /dev/sdc2

That would set home directory's created at time to 1/23/2024 at its start.

There is also mtime and atime like those. There may also be "i_" or "st_" prefixed times and extras so set them too if supported. I have heard that "crtime" is not standard and could be "btime" and "ctime" could be replaced by "chgtime" on some systems. You can get all supported timestamps to set with "debugfs" with inside it "sif -l" which will list all it can set. USE AT YOUR OWN RISK. Thanks "Petri Kaukasoina" at linuxquestions.org for info and testing this and also Theodore Ts'o, maker of debugfs, for info. Order to set all timestamps would be crtime, atime, mtime, ctime if you want them to stay. Read "man debugfs" in a terminal before attempting this.

X E.