RoboCopy Ownership from ReFS to NTFS

1,187 views
Skip to first unread message

Adam Marshall

unread,
Mar 1, 2021, 12:13:50 PM3/1/21
to ntsysadmin
Question: Has anyone got copying ownership to work when copying from ReFS to NTFS?
My Command:
ROBOCOPY %SOURCE% %DESTINATION% /MIR /SEC /SECFIX /V /R:10 /W:10 /NP /Z /mt:96 /LOG+:%LOG%

Background:

It is with a heavy heart that I must migrate away a file server from ReFS to NTFS because ReFS is STILL not what I would consider ready for production use, even though there are lots of people suggesting moving to ReFS. 2 Years ago I chose to go ReFS because it had the similarities from the Microsoft side to mimic ZFS which I was coming from at the time. After implementing a 6TB dynamically expanding VHDX and copying over ~5.3TB of data, I started to see why ReFS is not, in my opinion, production ready. My first issue was migrating away from Offline Files to "Work Folders". Work Folders does not support ReFS (Strike 1). My second issue was when I deleted ~1.2 TB of data that transferred to O365 with our email migration (PST Archive files), I went to go shrink the ReFS VHDX and after following a regimen that works wonderfully (posted below) to shrink VHDX files, the ReFS VHDX remained the SAME size. After doing some digging, VHDX shrinking does not support ReFS volumes (Strike 2). It was clear I was going to need to move the data to a new volume that was NTFS. Great. I've got DFS setup, I'll spin up a new server, create a new VDHX, format it in NTFS, setup the new server as a new DFS Target, and implement DFS Replication to sync the data.... NOPE!!!! DFS Replication does not support ReFS (Strike 3).

OK... Horrible, but let's go to the tried and true method of RoboCopy
ROBOCOPY %SORC% %DEST% /MIR /SEC /SECFIX /V /R:10 /W:10 /NP /Z /mt:96 /LOG+:%LOG%

Copies correctly, but doesn't transfer ownership.

What am I doing wrong, or is it that RoboCopy doesn't support ReFS for ownership transfer? (That would be Strike 4)


Just for those who are wondering about the Shrinking of the VHDX files,these are the commands I run to compact my VHDX files. Make sure the VM is completely shut down first of course.

Mount-VHD "D:\FILENAME.vhdx"
Assuming D is the drive letter the VHDX file mounts to:
defrag d: /x
/u /v
defrag d: /k /l
/u /v
defrag d: /x
/u /v
defrag d: /k
/u /v
Dismount-VHD "D:\FILENAME.vhdx"
Optimize-VHD "D:\FILENAME.vhdx" -Mode Full

After that the file should be compacted to the smallest size it can be.

Micheal Espinola

unread,
Mar 1, 2021, 3:54:21 PM3/1/21
to ntsys...@googlegroups.com
I think you will need to use /COPYALL. I've never done it from ReFS, but I've seen references from years back.

--
You received this message because you are subscribed to the Google Groups "ntsysadmin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ntsysadmin+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntsysadmin/910acdc7-5871-40b3-8fb8-7a32bc2ef667n%40googlegroups.com.


--
Espi

Charles F Sullivan

unread,
Mar 1, 2021, 4:14:35 PM3/1/21
to ntsys...@googlegroups.com
I agree. Looking at the syntax, I don't think there is anything which would copy over ownership or auditing settings.

By default, the data, attributes and time stamps (DAT) are copied. You have the NTFS perms covered by /sec (brings it to DATS). The /copyall switch covers everything (DATSOU).

I also use /dcopy:DAT, since that is how to copy over the directory time stamps, otherwise they will have the time of the file copy (default is DA).



--

Charlie Sullivan

Principal Windows Systems Administrator

Boston College

197 Foster St. Room 367

Brighton, MA 02135

617-552-4318

Adam Marshall

unread,
Mar 1, 2021, 4:29:49 PM3/1/21
to ntsysadmin
I forgot to mention, I've tried /COPY:DATSOU which is what /COPYALL is equivalent to. Tried again by renaming the folder and running it with
ROBOCOPY %SOURCE% %DESTINATION% /COPYALL /MIR /SEC /SECFIX /V /R:10 /W:10 /NP /Z /mt:96 /LOG+:%LOG%

Same issue Files copied, Ownership not. It does copy Permissions though, so the S is working properly.

Micheal Espinola

unread,
Mar 1, 2021, 4:38:10 PM3/1/21
to ntsys...@googlegroups.com
Just for giggles, try /COPYALL. You never know when/if quirky behavior is introduced over the years



--
Espi

Micheal Espinola

unread,
Mar 1, 2021, 4:39:49 PM3/1/21
to ntsys...@googlegroups.com
My bad, I overlooked that you did in fact try the /COPYALL command directly
--
Espi

Henry Awad

unread,
Mar 1, 2021, 4:54:09 PM3/1/21
to ntsys...@googlegroups.com
Try removing the /MIR switch. If I remember correctly, I had issues using the /MIR and /COPYALL switches together in the past.

robocpy %SORC% %DEST% /fft /copyall /SEC /SECFIX /V /R:10 /W:10 /NP /mt:96 /LOG+:%LOG%

Henry Awad
Senior Systems Engineer
Technology Services
The Catholic University of America

Micheal Espinola

unread,
Mar 1, 2021, 5:06:41 PM3/1/21
to ntsys...@googlegroups.com
I've seen postings online that support /COPYALL has worked in the past to migrate permissions from ReFS to NTFS, so I agree with Henry that you may need to sanitize some possibly conflicting/interfering command options.

If a copy-type tool cannot be used, you should be able to use a ReFS-aware backup program to migrate via a backup/restore process



--
Espi

Matt Stork

unread,
Mar 1, 2021, 5:49:25 PM3/1/21
to ntsys...@googlegroups.com
Have you tried running the sync without /SECFIX? It is unclear what it does from the built-in help. You might be trying to fix something, which is not broken, which ends up breaking the transfer of ownership. I would also try it without the /mt flag. No real reason why to not use it beyond trying to simplify things.

I would add /dcopy:t to your sync command. Without it, all folder have a new creation date of when robocopy was last run. Highly annoying.

You do not list what OS is the source data lives on nor the OS of the designation server or where you are running the command from. That level of detail would be very helpful.
-Matt
To view this discussion on the web visit https://groups.google.com/d/msgid/ntsysadmin/910acdc7-5871-40b3-8fb8-7a32bc2ef667n%40googlegroups.com <https://urldefense.com/v3/__https://groups.google.com/d/msgid/ntsysadmin/910acdc7-5871-40b3-8fb8-7a32bc2ef667n*40googlegroups.com?utm_medium=email&utm_source=footer__;JQ!!Dq0X2DkFhyF93HkjWTBQKhk!H9hELrg01oYH91yFEKfG9UsTvT_UbUYz6IQwAhlY0mD7ufQSKETD5DK_YvvKg31RUVil$> .




--

Espi

--
You received this message because you are subscribed to the Google Groups "ntsysadmin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ntsysadmin+...@googlegroups.com <mailto:ntsysadmin+...@googlegroups.com> .
To view this discussion on the web visit https://groups.google.com/d/msgid/ntsysadmin/ba161573-2e63-482c-8314-ecd65681279an%40googlegroups.com <https://urldefense.com/v3/__https://groups.google.com/d/msgid/ntsysadmin/ba161573-2e63-482c-8314-ecd65681279an*40googlegroups.com?utm_medium=email&utm_source=footer__;JQ!!Dq0X2DkFhyF93HkjWTBQKhk!H9hELrg01oYH91yFEKfG9UsTvT_UbUYz6IQwAhlY0mD7ufQSKETD5DK_YvvKg-DXI70n$> .

Philip Elder

unread,
Mar 1, 2021, 8:04:01 PM3/1/21
to ntsys...@googlegroups.com

Not specific to but related: BeyondCompare by www.scootersoftware.com.

 

RunAsAdmin and it will copy permissions. Now, I don’t know if it will do ReFS to NTFS but it’s worth a shot.

 

We use it for all of our point to point data migrations because it’s multi-threaded, it tracks changes/errors, and it has a decent GUI.

 

Philip Elder MCTS

Microsoft High Availability MVP

E-mail: Phili...@mpecsinc.ca

Phone: +1 (780) 458-2028

Web: www.mpecsinc.com

Cloud: www.CanadianCloudWorx.com

Blog: blog.mpecsinc.com

Twitter: Twitter.com/MPECSInc

Skype: MPECSInc.

 

Please note: Although we may sometimes respond to email, text and phone calls instantly at all hours of the day, our regular business hours are 8:00 AM - 5:00 PM, Monday thru Friday.

 

From: ntsys...@googlegroups.com <ntsys...@googlegroups.com> On Behalf Of Adam Marshall
Sent: March 1, 2021 14:30
To: ntsysadmin <ntsys...@googlegroups.com>
Subject: Re: [ntsysadmin] RoboCopy Ownership from ReFS to NTFS

 

I forgot to mention, I've tried /COPY:DATSOU which is what /COPYALL is equivalent to. Tried again by renaming the folder and running it with

Adam Marshall

unread,
Mar 2, 2021, 8:50:37 AM3/2/21
to ntsys...@googlegroups.com

THANK YOU GUYS!

 

Phillip, your guidance hit me in the head. I had been running this as an admin account, but NOT elevated. (I'm sure it has to do with setting the permissions locally as I have full rights to the network share)

 

I right clicked, Run As Admin on my batch script and using

ROBOCOPY %SOURCE% %DESTINATION% /COPYALL /SECFIX /MIR /R:10 /W:10 /NP /Z /mt:96 /LOG+:%LOG%

It works!

 

It  probably works with my original robocopy command (I'll try that too). I'll write some code into the batch that forces running in elevated permission. Normally I self document everything, so I'm not sure how this part was missed.

 

What a DUH! moment.

 

Adam Marshall

https://www.ajtek.ca

 

Microsoft MVP

2018-2021

--
You received this message because you are subscribed to a topic in the Google Groups "ntsysadmin" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ntsysadmin/H4BroG3xDfU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ntsysadmin+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntsysadmin/a8ba1eb493a74fed9e7003ed31d8226d%40MPECSInc.Ca.

Mike Leone

unread,
Mar 2, 2021, 9:22:28 AM3/2/21
to NTSysAdmin
On Tue, Mar 2, 2021 at 8:50 AM Adam Marshall <adamjohn...@gmail.com> wrote:
>
> It probably works with my original robocopy command (I'll try that too). I'll write some code into the batch that forces running in elevated permission. Normally I self document everything, so I'm not sure how this part was missed.

I'd like to see batch file code that forces the script into running
with elevated permissions, if you don't mind. I've seen Powershell
code, but not CMD code that automatically elevates a script.

Congratulations on getting it to work!

Tony Burrows

unread,
Mar 2, 2021, 10:29:32 AM3/2/21
to ntsys...@googlegroups.com
This is what I use in my BATCH scripts to force running as an admin.

REM Administrative permissions required. Detecting permissions...
NET SESSION >nul 2>&1
IF %errorLevel% == 0 (
    ECHO Success: Administrative permissions confirmed.
) ELSE (
    ECHO Failure: Current permissions inadequate.
    ECHO PLEASE RUN AS ADMINISTRATOR.
    GOTO :SCRIPT_END
)
ECHO RUNNING AS ADMINISTRATOR.

Regards,
Tony


Regards,
Tony Burrows


--
You received this message because you are subscribed to the Google Groups "ntsysadmin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ntsysadmin+...@googlegroups.com.

Mike Leone

unread,
Mar 2, 2021, 10:45:48 AM3/2/21
to NTSysAdmin
Thanks. I thought there was some way for the script to elevate itself
while running, rather than prompting the user to do it.. Still, it's
good to know a way to identify running as admin or not.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ntsysadmin/CAPGALdiZih4JtcuYaNJTTQ51M5gTO-fKaTEe001eXeE79h4o4g%40mail.gmail.com.



--

Mike. Leone, <mailto:tur...@mike-leone.com>

PGP Fingerprint: 0AA8 DC47 CB63 AE3F C739 6BF9 9AB4 1EF6 5AA5 BCDF
Photo Gallery: <http://www.flickr.com/photos/mikeleonephotos>

This space reserved for future witticisms ...

Michael B. Smith

unread,
Mar 2, 2021, 10:58:00 AM3/2/21
to ntsys...@googlegroups.com
It's non-trivial.

Here is one way: https://stackoverflow.com/questions/7044985/how-can-i-auto-elevate-my-batch-file-so-that-it-requests-from-uac-administrator/12264592#12264592

-----Original Message-----
From: ntsys...@googlegroups.com <ntsys...@googlegroups.com> On Behalf Of Mike Leone
Sent: Tuesday, March 2, 2021 10:45 AM
To: NTSysAdmin <ntsys...@googlegroups.com>
Subject: Re: [ntsysadmin] RoboCopy Ownership from ReFS to NTFS

To view this discussion on the web visit https://groups.google.com/d/msgid/ntsysadmin/CAHBr%2B%2Bi6i5Rv5P8Tr7fyg3585okRZCTm7Dg9g%3Duq%2Bpf13W5Bzw%40mail.gmail.com.

Micheal Espinola

unread,
Mar 2, 2021, 12:28:27 PM3/2/21
to ntsys...@googlegroups.com
I also include NET SESSION-based condition checker in a majority of my batch scripts to check for admin rights - including when I DON'T want it running as admin:

NET SESSION>NUL 2>&1
IF [%ERRORLEVEL%] EQU [0] (
    ECHO.
    ECHO  * You must NOT run this script with Administrator privileges.
    ECHO.
    PAUSE
    GOTO :END
)

I also incorporate a pause in case I accidentally add or call a script like this with automation. A hung/paused condition will allow me to troubleshoot more efficiently.



--
Espi

Mike Leone

unread,
Mar 5, 2021, 9:59:10 AM3/5/21
to NTSysAdmin
That looks very scary to me. :-) Pass. Checking and stopping if not
elevated, and prompting for re-running, looks to be the way to go (for
me).

Thanks
> To view this discussion on the web visit https://groups.google.com/d/msgid/ntsysadmin/f2ca351e603b4dcda1a8fe3f01f04ebe%40smithcons.com.
Reply all
Reply to author
Forward
0 new messages