How to preserve crtime when copying from NTFS to EXT4?

Kernels & Hardware, configuring network, installing services

How to preserve crtime when copying from NTFS to EXT4?

Postby jaja » 2018-02-27 23:31

Hello and thanks for the help.

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

I'm copying from a Windows-7 NTFS computer to a Debian/Buster EXT4 computer (both NTFS and EXT4 file systems support "creation/birth time", called "crtime").
Below is what I've tried:

Mount the Window-7 NTFS file system on to the Debian/Buster computer:
Code: Select all
 sudo apt-get update
 sudo apt-get install cifs-utils
 sudo mkdir /media/BACKUP
 sudo mount -t cifs //<Windows-7 computer IP Address>/c /media/BACKUP -o "username=<Windows-7 User Name>"


Use "rsync" to copy a folder from NTFS to EXT4. Then check "crtime" on one of the copied files:
Code: Select all
 rsync -avzhHEA --delete /media/BACKUP/TEST ~/TEST_rsync
 sudo apt-get install e2fsprogs
 sudo debugfs -R 'stat /home/<user>/TEST_rsync/<filename>' <device>

"crtime" on the copied file is the copy time, not the original NTFS creation time. (For the copied file: ctime and crtime are the same, the copy time.)

Use "cp" to copy a folder from NTFS to EXT4. Then check "crtime" on one of the copied files:
Code: Select all
 cp -pr /media/BACKUP/TEST ~/TEST_cp
 sudo apt-get install e2fsprogs
 sudo debugfs -R 'stat /home/<user>/TEST_cp/<filename>' <device>

"crtime" on the copied file is the copy time, not the original NTFS creation time. (For the copied file: ctime and crtime are the same, the copy time.)

So both "rsync" and "cp" failed to copy the original NTFS "crtime". Instead, "rsync" and "cp" changed "crtime" to the copy time.

What am I doing wrong?
How do I preserve "crtime" (creation/birth time) when copying from NTFS to EXT4?

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

Re: How to preserve crtime when copying from NTFS to EXT4?

Postby pcalvert » 2018-02-28 15:25

Hi,

This is what I used when I used rsync to back up a bunch of user files on NTFS to ext4:
Code: Select all
# rsync -rtv <path-to-source-dir> <path-to-dest-dir>

It seemed to work, but I didn't check things very closely.

BTW, I learned about that here:
http://www.clug.org/rsync-to-fat32-drives/

Phil
“Property is the fruit of labor; property is desirable; it is a positive good
in the world. That some should be rich shows that others may become
rich, and hence is just encouragement to industry and enterprise.”
— Abraham Lincoln
pcalvert
 
Posts: 1794
Joined: 2006-04-21 11:19
Location: Sol Sector

Re: How to preserve crtime when copying from NTFS to EXT4?

Postby jaja » 2018-02-28 16:20

pcalvert, thank you for your response.
Unfortunately, your suggestion does not solve the problem.
I'm using the rsync "-a" option, which is equivalent to "-rlptgoD".
So my options are a super-set of the ones you suggested.

Apples version of rsync includes a "-N" option specifically to add "crtime".
Unfortunately, this option is not available in Debians version of rsync.
That's why I also tried "cp -p", which should have copied *ALL* of the time data.
Unfortunately, both rsync and cp failed to include "crtime".

Again, thanks for taking a shot.
jaja
 
Posts: 23
Joined: 2016-01-25 00:20

Re: How to preserve crtime when copying from NTFS to EXT4?

Postby alan stone » 2018-03-01 05:01

Does this help: ntfs to ext4?
Last edited by alan stone on 2018-03-01 21:43, edited 2 times in total.
Debian 8.10 32bit, WM: Openbox
If everyone is thinking alike then somebody isn't thinking. - George S. Patton
User avatar
alan stone
 
Posts: 256
Joined: 2011-10-22 14:08
Location: In my body.

Re: How to preserve crtime when copying from NTFS to EXT4?

Postby p.H » 2018-03-01 12:19

jaja wrote:sudo mount -t cifs //<Windows-7 computer IP Address>/c /media/BACKUP -o "username=<Windows-7 User Name>"

Note that you are not copying from NTFS but from CIFS/SMB.
p.H
 
Posts: 520
Joined: 2017-09-17 07:12

Re: How to preserve crtime when copying from NTFS to EXT4?

Postby jaja » 2018-03-01 17:03

p.H, thank you for the correction.
Do you have a suggestion as to a different set of mount options?
Again, thanks for the help.
jaja
 
Posts: 23
Joined: 2016-01-25 00:20

Re: How to preserve crtime when copying from NTFS to EXT4?

Postby jaja » 2018-03-01 17:06

alan stone, thank you for your info.
I just completed a test based on your link.
Unfortunately, the crtime problem remains, even when using tar.
Thank you for your info. I appreciate your effort.
jaja
 
Posts: 23
Joined: 2016-01-25 00:20

Re: How to preserve crtime when copying from NTFS to EXT4?

Postby alan stone » 2018-03-01 21:39

Debian 8.10 32bit, WM: Openbox
If everyone is thinking alike then somebody isn't thinking. - George S. Patton
User avatar
alan stone
 
Posts: 256
Joined: 2011-10-22 14:08
Location: In my body.

Re: How to preserve crtime when copying from NTFS to EXT4?

Postby jaja » 2018-03-01 22:00

alan stone wrote:For your information: Get file creation time on Linux with EXT4.


Yes, I've seen that post, along with several others detailing the history of crtime within the Linux community. Of these posts, the one I'm focused on is:
https://unix.stackexchange.com/question ... ation-date
It states that the crtime capabilities that I need were finally added into kernel 4.11 (I'm using 4.14).
Hence, my investigations.

Thanks for looking deeper into it.
jaja
 
Posts: 23
Joined: 2016-01-25 00:20


Return to System configuration

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable
cron