Windows. Files permissions changed during copy from one NTFS disk to NTFS another

  amazon-ec2, ntfs, permissions, registry, windows

I have an issue with file permissions during copying it between two volumes.

Initially, I installed MSSQL Server to drive M:. The service started as expected.
Then drive M: has been successfully renamed to drive D:.
Additional volume has been added. Volume has been added as xvdb. Drive M: on that volume has been created.
Then I copied everything from Drive D: to drive M: with the command below:

robocopy D: M: /MIR /R:0 /NP /XD

Also, I tried to do it with the PowerShell – the same issue, permissions were changed during the copy process.
When I tried to start the SQL server – I faced the issue "Access Denied". During some investigation, I understood, that I have a problem with the file’s permissions after copying.

When I tried to check do I have the same file permissions on both disks, I realized, that it was reset during copying.
Below, I pasted the output from the command line, and there you can see, that after copying files permissions were changed. And Full access for Users has been removed.

C:>robocopy D: M: /MIR /R:0 /NP /XD $RECYCLE.BIN "System Volume Information" > "C:tempD.log") ^& IF %ERRORLEVEL% LEQ 1 exit 0

C:>D:

D:MSSQL14.MSSQLSERVERMSSQLDATA>cd MSSQL14.MSSQLSERVERMSSQLDATA
The system cannot find the path specified.

D:MSSQL14.MSSQLSERVERMSSQLDATA>icacls master.mdf
master.mdf BUILTINUsers:(F)
           BUILTINAdministrators:(I)(F)
           NT AUTHORITYSYSTEM:(I)(F)
           BUILTINUsers:(I)(RX)

Successfully processed 1 file; Failed processing 0 files

D:MSSQL14.MSSQLSERVERMSSQLDATA>M:

M:MSSQL14.MSSQLSERVERMSSQLDATA>icacls master.mdf
master.mdf BUILTINAdministrators:(I)(F)
           NT AUTHORITYSYSTEM:(I)(F)
           BUILTINUsers:(I)(RX)

Successfully processed 1 file; Failed processing 0 files

I tried to investigate it a bit and found a post: https://docs.microsoft.com/en-US/troubleshoot/windows-client/windows-security/permissions-on-copying-moving-files

Based on that post, I added the ForceCopyAclwithFile parameter to the registry.
Tried to copy the same files from D: drive to M: drive and faced with the same issue.

I’m trying to do all mentioned actions in the Amazon cloud. I’ve already created a support request to AWS support, but still haven’t for a solution for that.

Could you please help me save file permissions during the copying process?

Regards,
Ihor

Source: Windows Questions

LEAVE A COMMENT