Issue with "Modified" timestamps on Windows file copy

nharrington

Dabbler
Joined
Feb 26, 2020
Messages
10
This past weekend I migrated from a Netgear ReadyNAS system to FreeNAS. The migration went pretty smoothly, but since migrating, I have discovered an issue with the "modified" timestamp on files copied from Windows getting changed to the date/time of the copy, rather than being preserved as the date/time that the file was last changed.

Note that all of the timestamps associated with the migration to FreeNAS are correct; I'm referring to the timestamps of files that I copy from Windows to FreeNAS now that the migration is complete.

I have tried copying files using the COPY command, the XCOPY command, Windows Explorer, and the ROBOCOPY command.

When files are copied from a local Windows drive to a local Windows drive, the modified timestamps are preserved regardless of which method I used to copy the files

When files are copied from a local Windows drive to an SMB share on FreeNAS, files copied with COPY, XCOPY, and Windows Explorer all have their modified timestamp updated to the date/time that the copy occurred; only ROBOCOPY appears to preserve the modified timestamp of the file.

I have confirmed this behavior on Windows 10 Professional v18363 and Windows 7 Professional w/SP1.

The fact that ROBOCOPY is able to preserve the modified timestamp indicates that doing so is possible with the share as it is configured, but why is ROBOCOPY the only method of the four that actually preserves the timestamp?

Is there a setting in FreeNAS, the SMB service, the SMB share, or somewhere else that is causing COPY, XCOPY, and Windows Explorer to not preserve the timestamp? How can I fix this?

FreeNAS-11.3-U1, 72GB RAM, 8x2TB SATA RAID-Z2
VFS Objects on SMB share = fruit, ixnas, streams_xattr

Copies from local drive to local drive using (left to right) COPY, Windows Explorer, ROBOCOPY, and XCOPY
(All Modified timestamps are preserved):
snap100764.png



Copies from local drive to FreeNAS SMB share using (left to right) COPY, Windows Explorer, ROBOCOPY, and XCOPY
(Modified timestamp only preserved by ROBOCOPY):
snap100765.png
 

hwoffinden

Cadet
Joined
Feb 28, 2020
Messages
4
I have the exact same issue after I upgraded from FreeNAS 11.2-U7 -> 11.3-RELEASE -> 11.3-U1.

FreeNAS-11.3-U1, 32GB RAM, 8x4TB SATA RAID-Z2
VFS Objects on SMB share = streams_xattr, zfs_space, zfsacl

On 11.2-U7 timestamp were transferred correct.
Client is Windows 10 Pro
No manual changes have been made to the share.
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,545
FreeBSD doesn't allow setting a create time that is more recent than the modify time. This is perhaps something we can change in 12.0, but it is a change that will probably require a new syscall in FreeBSD.
 

LarryG

Dabbler
Joined
Aug 1, 2013
Messages
13
I'm also having this issue, except mine is also failing when using robocopy. Also upgraded from 11.2-U7 -> 11.3-RELEASE -> 11.3-U1. The timestamp of the files on FreeNAS are always stored with a mod date equal to the time the file was copied to the FreeNAS server. Really destroys the ability to use my backup software as the backup now copies all the 1000's of files I've selected for backup rather than the few that were modified.
 

hwoffinden

Cadet
Joined
Feb 28, 2020
Messages
4
Is there a temporary work-around to fix this?
My backup is now also copying all 360GB every time.
 

LarryG

Dabbler
Joined
Aug 1, 2013
Messages
13
This doesn't seem to agree with what I'm seeing in files copied to my FreeNAS server with 11.2 and older versions of FreeNAS.

Sample.jpg
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,545
Samba can alternatively store the create time in an xattr (that's part of what the parameter "store dos attributes = yes" does). If you need this, you can replace "ixnas" with "zfsacl" in the VFS modules, (and not set "store dos attributes = no"), and restart Samba. The problem with doing this in an xattr is that the file create time becomes application-dependent.
 

LarryG

Dabbler
Joined
Aug 1, 2013
Messages
13
I'm already using zfsacl.

attributes.jpg


and don's see the option 'store dos attributes' anywhere. Where is it located?
 

LarryG

Dabbler
Joined
Aug 1, 2013
Messages
13
Unfortunately, to get things running again, I had to reboot my system using the last 11.2 release I had loaded. I had not updated my zpool attributes and the pools were still accessible. Copying from Windows 10 to FreeNAS now works correctly and modify dates are set to the date on the Windows 10 datasets, not the date copied.
The Release notes for these new 11.3 releases should be modified with a strong warning that upgrading will remove the ability to use any Windows backup software with FreeNAS 11.3.
 

nharrington

Dabbler
Joined
Feb 26, 2020
Messages
10
FreeBSD doesn't allow setting a create time that is more recent than the modify time. This is perhaps something we can change in 12.0, but it is a change that will probably require a new syscall in FreeBSD.
Are you saying that the creation time is set to the time of the copy and since it can't be more recent than the modification time that the modification time must be set to the time of the copy as well? If so, why/how is ROBOCOPY able to preserve both creation and modification timestamps when copying to FreeNAS, but COPY, XCOPY, and Windows Explorer aren't? Is it because ROBOCOPY is also preserving the creation time which then makes it less recent than the existing modified time so it can be preserved as well?

If I'm understanding this correctly, it is possible to set both the creation and modification timestamps now, this change would just make it easier?

Samba can alternatively store the create time in an xattr (that's part of what the parameter "store dos attributes = yes" does). If you need this, you can replace "ixnas" with "zfsacl" in the VFS modules, (and not set "store dos attributes = no"), and restart Samba. The problem with doing this in an xattr is that the file create time becomes application-dependent.
What is different between COPY, XCOPY, and Windows Explorer (aren't preserving modified timestamps) vs ROBOCOPY (does preserve modified timestamp)? All four of them work correctly locally, but only ROBOCOPY works correctly with FreeNAS.

Unfortunately, to get things running again, I had to reboot my system using the last 11.2 release I had loaded. I had not updated my zpool attributes and the pools were still accessible. Copying from Windows 10 to FreeNAS now works correctly and modify dates are set to the date on the Windows 10 datasets, not the date copied.
The Release notes for these new 11.3 releases should be modified with a strong warning that upgrading will remove the ability to use any Windows backup software with FreeNAS 11.3.
I started with 11.3, so I don't have anyway to confirm this, but from this post it sounds like it worked correctly in 11.2, but is now broken in 11.3. Yes?
 

hwoffinden

Cadet
Joined
Feb 28, 2020
Messages
4
I have updated my zpool attributes, so I assume that I can't go back to 11.2, correct?
Can I do something else to get the Windows original timestamp when copied to FreeNAS?

I also tried the solution you gave 5 posts up, but I had same result as LarryG. No luck.
 

tonci

Dabbler
Joined
Mar 14, 2013
Messages
18
I also have the same issue with 11.3-u1 ... I have to backup 2T of data and 99% files are tagged as "older" ... I agree with larryg and hwoffinden ...
but it seems that 11.3 is still working correct ... something went wrong in this last step/upgrade
Please correct this a.s.a.p
and thank you very much in advance
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,545
I also have the same issue with 11.3-u1 ... I have to backup 2T of data and 99% files are tagged as "older" ... I agree with larryg and hwoffinden ...
but it seems that 11.3 is still working correct ... something went wrong in this last step/upgrade
Please correct this a.s.a.p
and thank you very much in advance
This will be fixed in U2, but I will provide steps to fix in U1 here once I have time to test the fix.
 

hwoffinden

Cadet
Joined
Feb 28, 2020
Messages
4
I reverted from 11.3-U1 to 11.3-RELEASE, and the timestamp of files copied from Windows to FreeNAS are now correct again.
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,545
If you feel enterprising, you can extract the attached zipped file, clone your boot environment, and replace /usr/local/lib/shared-modules/vfs/zfsacl.so with it. Once you do this run the command "service smbd onerestart".
 

Attachments

  • zfsacl.so.zip
    42.3 KB · Views: 457

LarryG

Dabbler
Joined
Aug 1, 2013
Messages
13
Just as a test, I followed your instructions: cloned 11.3-U1 boot, restarted FreeNAS, replaced zfsacl with your new code and restarted smb. Did a few drag and drops from Windows 10 to FreeNAS and dates are working as in 11.2. Modify dates from the original windows datasets are retained.

One thing I did notice is that your new code executable is quite large compared to the original zfsacl.so. Original executable is about 38K where new code is 104K. Looks like a lot of refactoring went into the changes. Thanks.

Will continue to use your modified code until 11.3U-2 is released. Any idea when that's scheduled?
 
Last edited:
Top