How to preserve creation time when copying NTFS TO EXT4?

If none of the more specific forums is the right place to ask

How to preserve creation time when copying NTFS TO EXT4?

Postby jaja » 2018-03-08 07:29

Hello and thanks for the help.

How do I preserve "crtime" (creation/birth time) when copying from Windows NTFS to Linux EXT4?

I'm trying to copy files from a Windows-7 NTFS computer to a Debian/testing/Buster EXT4 computer (kernel version 4.14).
Unfortunately, the "creation/birth time" of the copied files gets changed to the time of copying.

Below is what I've tried:
On Windows-7 computer, copy files (including creation/birth time, "crtime") to USB stick:
Code: Select all
 <plug-in NTFS USB stick, E: drive>
   <format USB stick to NTFS>
   robocopy C:\TEST E:\TEST /MIR /COPYALL /DCOPY:T /SECFIX /TIMFIX
   <use "Windows Explorer" to verify correct file creation time ("crtime") on NTRF USB stick>
   <eject NTFS USB stick>


On Debian/testing/Buster computer, copy files (including creation/birth time, "crtime") from USB stick:
Code: Select all
  <plug-in NTFS USB stick>
   rsync -avzhHEA --delete <NTFS USB mount point>/TEST ~

Check "crtime" on a file copied from NTFS to EXT4 using rsync:
Code: Select all
 sudo debugfs -R 'stat /home/<user>/TEST/file' <device>

"debugfs" reports that "crtime" (creation/birth time), "ctime", and "atime" are all changed when copying to EXT4. They are not their Windows NTFS values.
Only "mtime" (last modify time) is the correct Windows NTFS value.

So this procedure failed to copy the original NTFS "crtime".
Instead, it changed "crtime" to the time the file was copied to EXT4. (Additionally, "ctime" and "atime" were also changed when copied to EXT4. Only "mtime" was preserved.)

Further investigations:
I replaced "rsync" with "cp -p". "cp -p" also fails to preserve "crtime". So the problem is not unique to "rsync".

Next I looked into the file systems. Both NTFS & EXT4 file systems support "creation timestamp" (https://en.wikipedia.org/wiki/Compariso ... le_systems).
So the file systems are not the problem.

Next I looked into the kernel:
2010: discussions on adding "crtime" to kernel/stat were put on hold for 5 years, until 2015 (http://lists.gnu.org/archive/html/coreu ... 00047.html).
2016: "crtime" (creation/birth time) added to kernel/stat version 4.11 (https://git.kernel.org/pub/scm/linux/ke ... d296c8493f).
So the kernel should handle "crtime" today, 2018.

Summary:
The ability to read the "crtime" was added to kernel version 4.11 in 2016.
It's now 2018, and I'm using kernel version 4.14.
So the ability to access "crtime" should be present within the kernel.
Both file systems (NTFS and EXT4) support "crtime".
I've verified that "crtime" is present and correct on the files contained on the NTFS USB stick.
I've instructed both "rsync" and "cp" to copy all of the file parameters to the EXT4 Linux computer.
Yet files copied to EXT4 fail to retain their original creation/birth times (crtime).

What am I doing wrong?
Is there a kernel module or package I need to install?
How do I preserve "crtime" (creation/birth time) when copying from NTFS to EXT4?

Thanks for the help.
jaja
 
Posts: 29
Joined: 2016-01-25 00:20

Re: How to preserve creation time when copying NTFS TO EXT4?

Postby dilberts_left_nut » 2018-03-08 07:37

Duplicate thread locked.
AdrianTM wrote:There's no hacker in my grandma...
User avatar
dilberts_left_nut
 
Posts: 4912
Joined: 2009-10-05 07:54
Location: enzed


Return to General Questions

Who is online

Users browsing this forum: No registered users and 8 guests

fashionable