0

From Linux, if I alter files on an NTFS external HD so that I get some specific values for mtime, atime and ctime (readable with the stat command, and with ctime = mtime because one cannot change access permissions of files on NTFS from Linux - I think) and if I then connect the same external HD on a Windows 7 system, I see that Date modified = mtime (as expected) but I also get Date created = atime.

How comes atime takes the placeholder associated with the NTFS CTime timestamp, and is there a way to avoid this behavior, for example would using the noatime option on NTFS volumes be a proper solution? My goal is to be able to work from both Windows and Linux on this same external HD without mingling too much the timestamps.

Edit

After re-investigating the issue, it turns out that the problem is not present in the end. I must have been confused at the time I asked the question. I still leave the question as it has generated some comments and an answer.

6
  • But is it true that Linux really don't support creation time? Commented May 17, 2019 at 17:54
  • I think that you are talking about a serious inode change to make this happen. Commented May 17, 2019 at 18:20
  • It's often a good idea to read existing Q&As before asking a question. superuser.com/a/703927/38062 unix.stackexchange.com/a/407305/5132 unix.stackexchange.com/q/7562/5132 unix.stackexchange.com/q/24441/5132 Commented May 18, 2019 at 0:22
  • @JdeBP: I had already read all those Q&As. My question is not 'how to make Linux support creation times', it is 'how to make it not use the creation time placeholder of NTFS to put atime values. Commented May 18, 2019 at 6:45
  • You quite clearly have not read all of those, otherwise your question would not have the first sentence and third paragraph that it currently has. Commented May 18, 2019 at 11:54

1 Answer 1

0

This was too big to write as a comment, but I think it can help.

Well if you want to avoid this behavior, you can do something like this:

 $current_ctime=$(getfattr -n system.ntfs_crtime_be -e hex yourfile | grep system.ntfs_crtime_be | cut -d= -f2) 

Then after the changes restore the current_ctime using:

setfattr -n system.ntfs_crtime_be -v $current_ctime yourfile 

For multiple files, you can store for example all the ctimes using a for loop and restoring them in the same way for each file.

Not very beautiful but it works.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.