Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

How to preserve crtime when copying from NTFS to EXT4?

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
jaja
Posts: 53
Joined: 2016-01-25 00:20
Has thanked: 1 time

How to preserve crtime when copying from NTFS to EXT4?

#1 Post by jaja »

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.

pcalvert
Posts: 1939
Joined: 2006-04-21 11:19
Location: Sol Sector
Has thanked: 1 time
Been thanked: 2 times

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

#2 Post by pcalvert »

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
Freespoke is a new search engine that respects user privacy and does not engage in censorship.

jaja
Posts: 53
Joined: 2016-01-25 00:20
Has thanked: 1 time

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

#3 Post by jaja »

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.

User avatar
alan stone
Posts: 269
Joined: 2011-10-22 14:08
Location: In my body.

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

#4 Post by alan stone »

Does this help: ntfs to ext4?
Last edited by alan stone on 2018-03-01 21:43, edited 2 times in total.

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

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

#5 Post by p.H »

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.

jaja
Posts: 53
Joined: 2016-01-25 00:20
Has thanked: 1 time

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

#6 Post by jaja »

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: 53
Joined: 2016-01-25 00:20
Has thanked: 1 time

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

#7 Post by jaja »

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.

User avatar
alan stone
Posts: 269
Joined: 2011-10-22 14:08
Location: In my body.

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

#8 Post by alan stone »


jaja
Posts: 53
Joined: 2016-01-25 00:20
Has thanked: 1 time

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

#9 Post by jaja »

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.

Post Reply