2

I wanted to stop using Windows completely, but main problem with Linux I have is no way to change file creation date.

On Windows I use it everyday. It allows me to know when I started working on file. In file manager I can sort file copies by creation date or modified date depending on what I need. When I move file from ramdisk to SSD it preserves original file creation date. On Linux when I move a file from one partition to another, creation date is refreshed so it loses any meaning to me. And there's no way to change it to a date that I means something to me.

Another example. Sometimes I download videos from YouTube using yt-dlp. Modification timestamp tells me when the video has appeared on YT, creation timestamp tells me when I downloaded it. I can archive it with WinRAR and preserve these timestamps in archive, restore them later, move files to another disk without losing them. There are even GUI tools that allow changing timestamps of files and directories.

On Linux file creation timestamp is completely useless for me. I don't understand why Linux can't just allow me to change timestamps how I want. The only two reasons I can think about it debugging filesystem (but that's not something every user is doing) or investigating filesystem on a hacked server to see what has been changed, but that's probably not a good reason because when files are missing or modified they need to be restored from backup anyway so any new files could be compared to backup.

I would be very grateful if you could tell me how I can use these timestamps like on Windows or at least explain to me why Linux kernel is not allowing to change file creation timestamp. Filesystem I want to use is BTRFS if that helps.

EnnFore
  • 21
  • 2

1 Answers1

1

In general, in Linux, using the stat filename command, you can view the following times associated with a file:

Access (atime) is the last read access to the file. Modify (mtime) is the last modification of the file's contents. Change (ctime) is the last modification of the metadata, name, and permissions. Birth is the file's creation time.

atime and mtime can be changed using the touch command.

The touch command with the following parameters:

`-a` changes atime.
`-m` changes mtime.
`-t` changes the year, month, day, hour, minute, second format `[[CC]YY]MMDDhhmm[.ss]`.
`-r` copies the date from one referenced file to another.

Regarding ctime, since it is controlled by the system and is automatically updated when the metadata is modified, it cannot be changed directly.

Regarding birth (creation date), it is generally unavailable or cannot be changed.

With advanced knowledge of debugfs, you could directly manipulate the file system.

kyodake
  • 17,808