We help IT Professionals succeed at work.

move data from C drive to NAS

datatechdc
datatechdc asked
on
I have data on a terminal server that is stored on the C drive. i need to move this to the NAS but maintain the security permissions and just update the batch file to point to the new location.

how can i move the data and maintain the permissions?
Comment
Watch Question

Gary ColtharpSr. Systems Engineer

Commented:
robocopy <source> <dest> /mir
Top Expert 2012
Commented:
add /copyall to the above command: -

robocopy c:\ {nas drive letter} /copyall /mir

This will copy all security settings.

/COPY:copyflag[s] :: what to COPY for files (default is /COPY:DAT).
                     (copyflags : D=Data, A=Attributes, T=Timestamps).
                     (S=Security=NTFS ACLs, O=Owner info, U=aUditing info).

/COPYALL :: COPY ALL file info (equivalent to /COPY:DATSOU).

Open in new window

Author

Commented:
ok i am actually going to be creating an iSCSI target to one of my servers, making a new local disk appear. i would like to move the data from the VMs to this new drive.

what is the process for that?
Sr. Systems Engineer
Commented:
Well if you kinow how to create the iSCSI disk.... the process is the same to copy. The /copyall flag mentioned above will also keep timestamps, etc as they were on the original files.

If you need help creating an iSCSI disk, you should probably post a new question.

Author

Commented:
i have the iSCSI disk already created. i will review the copy commands.

Thanks.
nope - robocopy GUI is a cludge to run the command manually.  You need to understand what all the options for ROBOCOPY do to use the GUI so unless you know that, it's not much benefit.

Here is an example for you that assumes that your iSCSI drive has the letter of Q:\  and that the folder USERS exists on the Q:\ drive: -

ROBOCOPY C:\Users Q:\Users /COPYALL /MIR /ZB /R:0 /W:0

I've attached an explanation of each option for you.

/ZB will ensure that you don't get caught out by file permissions.
::
:: Copy options :
::
/E :: copy subdirectories, including Empty ones.
/ZB :: use restartable mode; if access denied use Backup mode.
/COPY:copyflag[s] :: what to COPY for files (default is /COPY:DAT).
                     (copyflags : D=Data, A=Attributes, T=Timestamps).
                     (S=Security=NTFS ACLs, O=Owner info, U=aUditing info).
/COPYALL :: COPY ALL file info (equivalent to /COPY:DATSOU).
/PURGE :: delete dest files/dirs that no longer exist in source.
/MIR :: MIRror a directory tree (equivalent to /E plus /PURGE).
/R:n :: number of Retries on failed copies: default 1 million.
/W:n :: Wait time between retries: default is 30 seconds.

Open in new window

Gary ColtharpSr. Systems Engineer

Commented:
robocopy is native....that is just a GUI wraparound. The arguments are easy....I would stick to command line.

Author

Commented:
ok so for my configuration i have the temrinal server (dt-ts1) and the server with the iSCSI disk initiated to it (dt-server1)

the root directory that i want to move does not have sharing permissions (only the folders within it do). i want to move it to the E drive on the dt-server1.

i would open command prompt on the dt-ts1 and type: C:\FOLDERNAME E:\ /COPYALL /MIR /ZB /R:0 /W:0

is this correct?
first things first.

does dt-ts1 have direct access to the iSCSI disk either directly using iSCSI or via a file share?  is the iSCSI disk drive E: on dt-ts1?

if it does, then the command will be: -

ROBOCOPY C:\FOLDERNAME E:\ /COPYALL /MIR /ZB /R:0 /W:0

if the E:\ isn't on dt-ts1, then the command will be: -

ROBOCOPY C:\FOLDERNAME \\dt-server1\e$ /COPYALL /MIR /ZB /R:0 /W:0

Remember though - if you want to have FOLDERNAME on the new drive, YOU MUST create the folder first and add it's path to E:\ or \\dt-server1\e$
Gary ColtharpSr. Systems Engineer

Commented:
I would leave off the /zb /r:0 and /w:0 flags... that would mean if you encountered a permissions issue or other reason that it couldnt copy, it would just skip it and not try again... you would have very few reliable means of discovering what did not copy.

Otherwise jakethecatuk is correct.... if you want to test....just copy a file from the command line using the source and target you want to use. If the file is in the correct location when you are done, the robocopy commands will do the whole store.
gcoltharp - you're wrong about the flags to leave off.

/ZB will mean that the files will be copied using backup mode if it can't copy using normal permissions.  leaving off /R means that the copy will retry 1,000,000 times (yes, that's right, 1,000,000) and leaving of /W will mean it will wait for 30 seconds between retries.  So, if a file can't be copied, it will take 30,000,000 seconds before it moves on to the next file.  30,000,000 seconds is 347 days!

Changing them to /R:1 and /W:1 will mean it will retry once and wait for 1 second.
Gary ColtharpSr. Systems Engineer

Commented:
if you set it to 0 it wont retry at all.... the default is 1 mil (no flag)