LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 10-21-2023, 03:18 PM   #1
L-28C
Member
 
Registered: Oct 2006
Posts: 38

Rep: Reputation: 0
Transferring legacy data from NTFS to ext4: is there inherent metadata loss by changing filesystems?


I need to switch 20+ years worth of highly sentimental data from its native NTFS to ext4, for a variety of performance and practical reasons. I'm worried about potentially losing data stored in the filesystem header and/or any other places where metadata may be stored in NTFS.

This data has been moved across NTFS volumes multiple times, and thus far the only noticeable loss I've experienced has been the timestamps on directories. I don't want to move the data and think everything is gucci but then find out a year later that some crucial piece of historic information got lost during the transfer.

So the question is: Is there anything NTFS holds that ext4 can't hold, or anything that cannot be translated between the two?

(Bonus question: Anybody knows how to copy a file tree and keep the directory timestamps? I really like my accurate timestamps. Not even rsync can pull this off)

Last edited by L-28C; 10-21-2023 at 03:20 PM.
 
Old 10-21-2023, 05:06 PM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,794

Rep: Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774
#1 there is data in the file system that does not translate and cannot be preserved by file systems with seriously different data structures. That said, I have never had any NTFS data lost during transfer to a Linux file system be a problem OTHER than timestamp data. If you have a way to handle that then you should be fine.

#2 speaking of time stamps: the DTG (Date Time Group_ structures are VERY different, and do not translate directly. Some programs do better than others at conversions, but do not expect fine granularity. When I started in the business FAT timestamps and Unix timestamps (it was PRE-NTFS and PRE-LINUX) were not converted properly by anything I had. If the data IN THE FILE is properly retained, that is a near best-case situation.

#3 As far as transfer of entire tree structures, rsync does pretty well. I have had luck with some archive software (tar) when combined with shell features doing a better job of transferring AND CONVERTING a tree than other software specifically made for the purpose. It has been a decade since I have done an NTFS->EXT4 transfer that way, so the tools have changed and you would want to run tests before counting on the technique.

Example command-line for #3 recovered from ancient and possibly corrupt meat memory:
Code:
cd /top/level/below_this;tar -cf - source | ( cd /target/folder && tar -xf - )
To clone the directory tree starting at folder /top/level/below_this/source to a new folder named source in /target/folder.
Again, this is from memory and needs testing.
 
Old 10-21-2023, 05:15 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,827

Rep: Reputation: 5964Reputation: 5964Reputation: 5964Reputation: 5964Reputation: 5964Reputation: 5964Reputation: 5964Reputation: 5964Reputation: 5964Reputation: 5964Reputation: 5964
As far as accuracy of timestamps NTFS precision is 100ns and ext4 is 1ns and therefore they probably will not be identical. With newer utilities you can preserve creation times with rsync's --crtime option but I don't know if it is compatible with NTFS. stat does not report birth times for NTFS on my debian 12.

Basically filesystem metadata are timestamps, file length and where the file is located which is separate from the file itself. metadata information for specific files like pdf, or jpeg's are stored within the file itself.
 
2 members found this post helpful.
Old 10-21-2023, 06:27 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,163

Rep: Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125
Data are data. If the "birth date" (i.e. the very first time a file was created) is significant, you will have to manage that yourself. Unless that has been dealt with since I last looked.
For things like (digital) photos, exif data generally has all that, but scanned photos/slides don't. I put the date in the filename, but if the date it was created is relevant you'll need to be careful.
 
1 members found this post helpful.
Old 10-31-2023, 04:04 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,023

Rep: Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632
Used to be that one would zip the data to preserve extended filesystem information but it only works ntfs to ntfs.
 
Old 10-31-2023, 06:56 PM   #6
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,794

Rep: Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774
Quote:
Originally Posted by jefro View Post
Used to be that one would zip the data to preserve extended filesystem information but it only works ntfs to ntfs.
Used to be we would connect an RS232 cable between the serial ports and dump ascii and capture it. But that was before NTFS existed (or Linux, for that matter.) Here is the thing: you should be filled with joy that you can transfer the DATA with great confidence in your chances for success, much less ANY of the MetaData. It was not long ago when getting data transferred (even simple text) was not a sure thing. (DON'T get me started on mixing big-endian and small-endian systems! What a hoot!)

We have the tools today for you to check the stats on all of your source files and make a database of the names and metadata you need, and make that one of the files you transfer. Although you might not get that metadata into the other file system, you can look it up in your data file if you need it.
 
Old 10-31-2023, 07:42 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,023

Rep: Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632
I'd zip it.
 
Old 11-04-2023, 11:07 AM   #8
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Just cp -a works for me.

I just tested it by moving a tree of files from an NTFS partition to an ext4 directory. All the names, timestamp (modified) were copied correctly and the directory structure preserved. The date created timestamp is NOT preserved however. Date modified might be the same as date created, but not necessarily.

I am going to have to do some tests with zip as jefro suggests.
This has been a learning experience!

I suggest you just try it. Remember, you are using cp and not mv !

[Edit]: The next bit is NOT CORRECT, I just checked

rsync copies timestamps if requested. I generally use rsync -avh /source/ /destination Be careful with that training slash at /source/ Best to check the man page.
But I have left it for posterity.
[/EDIT]

Last edited by tredegar; 11-04-2023 at 12:15 PM.
 
Old 11-09-2023, 05:42 PM   #9
kreemoweet
LQ Newbie
 
Registered: Jun 2017
Posts: 8

Rep: Reputation: Disabled
Didn't some sorts of Windows files have metadata stored in NTFS alternate streams?
Those would have to be checked for and dealt with. The utility Streams from MS's
Sysinternals Suite can survey a directory tree and notify of the existence of any
of those streams.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NAS ext4 drives initialized with Win10 Computer manager :( guid parttable and ext4 filesystem loss uyjjhak Linux - Server 4 04-20-2021 06:32 PM
Group inherent permissions in linux? link626 Linux - Newbie 1 09-13-2015 05:53 PM
Transferring Files from an NTFS Drive to an Ext4 Drive alemoo Linux - Newbie 14 02-09-2014 10:13 PM
Inherent a constant feature from a parent grob115 Programming 1 07-19-2012 11:25 AM
LXer: The Inherent Danger in "Just Working" LXer Syndicated Linux News 0 01-03-2009 03:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 04:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration