No file birth date

luk

Cadet
Joined
Dec 10, 2020
Messages
6
I've spent the last few weeks manually re-copying files from my 2 old HDDs to my truenas system using "rsync -a". I unfortunately realized just now that It did not preserve all of the times. Only the Modify date is being preserved. Also tried "touch -r", same results. Seing how a nas is often used for archiving I'm surprised to not find much information about how this can be done. This is the output from using "stat" on my mounted zfs pool.
Access: 2022-02-22 03:35:08.407776874 +0100 Modify: 2020-09-22 23:26:28.261613177 +0200 Change: 2022-02-22 03:35:08.412032700 +0100 Birth: -
Same command but on my old HDD (ext4).
Access: 2022-02-22 03:34:38.419441179 +0100 Modify: 2020-09-22 23:26:28.261613177 +0200 Change: 2022-02-22 03:34:35.902774550 +0100 Birth: 2020-09-22 23:23:40.934107799 +0200

As you can see the birth option isn't available, even if I create a file new it wont be there. Also what I found interesting is that if I cp or use rsync to copy a file to another drive that also is ext4 the birth date will be reset, so it does not seem to do with the different filesystems. I found some saying that linux will not keep track of the creation time since it is not required by POSIX and others say that it is supported in newer versions, etc. I find it confusing, was hoping that someone here could help me with this. Thanks for reading!
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,553
I've spent the last few weeks manually re-copying files from my 2 old HDDs to my truenas system using "rsync -a". I unfortunately realized just now that It did not preserve all of the times. Only the Modify date is being preserved. Also tried "touch -r", same results. Seing how a nas is often used for archiving I'm surprised to not find much information about how this can be done. This is the output from using "stat" on my mounted zfs pool.
Access: 2022-02-22 03:35:08.407776874 +0100 Modify: 2020-09-22 23:26:28.261613177 +0200 Change: 2022-02-22 03:35:08.412032700 +0100 Birth: -
Same command but on my old HDD (ext4).
Access: 2022-02-22 03:34:38.419441179 +0100 Modify: 2020-09-22 23:26:28.261613177 +0200 Change: 2022-02-22 03:34:35.902774550 +0100 Birth: 2020-09-22 23:23:40.934107799 +0200

As you can see the birth option isn't available, even if I create a file new it wont be there. Also what I found interesting is that if I cp or use rsync to copy a file to another drive that also is ext4 the birth date will be reset, so it does not seem to do with the different filesystems. I found some saying that linux will not keep track of the creation time since it is not required by POSIX and others say that it is supported in newer versions, etc. I find it confusing, was hoping that someone here could help me with this. Thanks for reading!
What version is this? In Linux the birth time is immutable. In FreeBSD, it can be set, but only in a cumbersome way. See, https://www.freebsd.org/cgi/man.cgi?query=utimensat&sektion=2&n=1 It's nuanced.

In TrueNAS 13 I added a new flag /special handling for utimensat(2) to allow direct birthtime changes, but it is currently only used by Samba.
So in that version synchronization of those files through SMB should preserve btime (assuming client tries to send it).
 

luk

Cadet
Joined
Dec 10, 2020
Messages
6
What version is this? In Linux the birth time is immutable. In FreeBSD, it can be set, but only in a cumbersome way. See, https://www.freebsd.org/cgi/man.cgi?query=utimensat&sektion=2&n=1 It's nuanced.

In TrueNAS 13 I added a new flag /special handling for utimensat(2) to allow direct birthtime changes, but it is currently only used by Samba.
So in that version synchronization of those files through SMB should preserve btime (assuming client tries to send it).
Version should be visible under my post (12.0-U1). I set up a smb share and the birth field is now available, but set to today. So I'm assuming in order to change the birth date I'd have to install the hdd's in my truenas system and then manually (file by file) through the truenas machine or web shell use utimensat to set the birth date? My other option is to upgrade to the most recent version, if I take this route how would I make the client send the information? I also read that the command "debugfs -w" could preserve times, not sure if it would work well with truenas/FreeBSD. Which method would you say is advised to use? Thanks!
 
Top