question

lyle-bowe avatar image
0 Votes"
lyle-bowe asked lylebowe commented

Undesired Updates to Azure File Share Last Modified Date

I have two standard/hot Azure Storage Accounts, SA1 and SA2. SA2 has AD DS enabled, and is joined to the domain. SA1 contains archive data, up to 2-March-2021. SA2 contains archive data, from 2-March-2021 to present. The following situations exist:

  1. Using the command .\azcopy copy 'https://SA1.file.core.windows.net/?sv=2020-02-10&ss=f&srt=sco&sp=rwdlc&se=2021-03-10T04:34:36Z&st=2021-03-02T19:34:36Z&spr=https&sig=REDACTED' 'https://SA2.file.core.windows.net/?sv=2020-02-10&ss=f&srt=sco&sp=rwdlc&se=2021-03-10T04:35:45Z&st=2021-03-02T19:35:45Z&spr=https&sig=REDACTED' --recursive --preserve-smb-info, all file shares are copied from SA1 to SA2 and the Last Modified Date from SA1 is retained. If I then view the properties of a folder within one of the shares on SA2, all files within the folder on SA2 which were copied with the aforementioned command now have an updated Last Modified Date of just a few minutes ago.

  2. Using the command ROBOCOPY \\SA1.file.core.windows.net\share \\SA2.file.core.windows.net\share /S /IS /IT, all share contents are copied from SA1 to SA2 and the Last Modified Date from SA1 is retained. If I then view the properties of a folder within the share on SA2, all files within the folder on SA2 which were copied with the aforementioned command now have an updated Last Modified Date of just a few minutes ago.

  3. Using the command XCOPY /S /F /Y \\SA1.file.core.windows.net\share \\SA2.file.core.windows.net\share, all share contents are copied from SA1 to SA2 and the Last Modified Date from SA1 is retained. If I then view the properties of a folder within the share on SA2, all files within the folder on SA2 which were copied with the aforementioned command retain the Last Modified Date.

  4. Using Windows File Explorer to copy all files from \\SA1.file.core.windows.net\share to \\SA2.file.core.windows.net\share, all share contents are copied from SA1 to SA2 and the Last Modified Date from SA1 is retained. If I then view the properties of a folder within the share on SA2, all files within the folder on SA2 retain the Last Modified Date.

I have also attempted copying the files from within the share on SA2 to a local folder using a C# application and File.Copy method. This too, has the same effect as mentioned in the above four situations.

I have not witnessed this behavior in the previous year on the SA1 storage account, however can consistently reproduce it on the SA2 storage account. We wish to retain the Last Modified Date of the files for ease of research and organization.

What am I doing incorrectly? Did I miss something when I configured the SA2 storage account?

Thanks in advance,

-Lyle

azure-storage-accountsazure-files
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

deherman-MSFT avatar image
0 Votes"
deherman-MSFT answered lylebowe commented

@lyle-bowe
The "preservation" of timestamps isn't really a feature of Azure Files per se, but rather the copy tool (i.e. AzCopy, Robocopy, etc.) that copies the file. When a file is written to disk, the copy tool is responsible for setting timestamps and any other metadata on the file to "preserve" them as desired by the user.

For AzCopy try explicitly setting --preserve-smb-info=true as outlined here in the docs, it is set to false by default. There is a recent issue created for AzCopy, let me know if you are still seeing this issue and I can make sure to escalate to the AzCopy team. For Robocopy you need to use the /COPY and /DCOPY options to preserve the timestamps. Good discussion on this can be found on this thread.

Hope this helps! Let me know if you have further questions or need further assistance.



Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @deherman-MSFT,

Thanks for the response. The issue is not the timestamp being lost during copy, but it is getting updated when I copy a file from the file share to another location. This isn't the normal behavior. The timestamp is retained when I use the AzCopy or Robocopy command, but it is updated the next time I read the file. This looks like something is not getting set correctly behind the scenes, like in the FAT. I welcome someone from either/both the AzCopy team and/or Azure File Storage team providing some guidance.

EDIT 10-March-2021: I believe this is the same issue reported here: https://github.com/Azure/azure-storage-azcopy/issues/1332. I will monitor this issue.

Thank you,

-Lyle

0 Votes 0 ·

@lyle-bowe The AzCopy team and Azure Files team have acknowledged the issue and are working to deploy a fix. I will provide an update once there is one available.

1 Vote 1 ·

Thank you for the update!

0 Votes 0 ·

@lyle-bowe Thanks for the additional information. I have reached out internally to escalate this issue and will provide an update once available.

0 Votes 0 ·

Hi @deherman-MSFT ,

Using the XCOPY command, I have copied all files from one file share to another file share. The last modified date is correctly displayed, both in the File Explorer window and in the file Properties window. The next step for me is to iterate the files using a Powershell Runbook. A snippet of this code is below. Strangely, the LastModified property comes back as the date of file creation on the new file share, for example 03/14/2021, while I was expecting the 12/20/2020 date seen both in File Explorer and the file Properties.

             foreach ( $file in $files )
             {
                 Write-Output ("`t`t`tFile: {0}" -f $file.CloudFile.Name)

                 $properties = Get-AzStorageFile -Context $storageAccountContext -ShareName $shareName -Path ( $file.CloudFile.Name )

                 Write-Output ("`t`t`t`tLastModified: {0}" -f $properties.LastModified)

             }

Thank you,

-Lyle

0 Votes 0 ·