This tip will show you how to effectively use the XCOPY command to migrate a Windows share from one server to another, or to another physical disk drive.
This is something I use all of the time when installing or migrating servers for customers.
First, backup all of the data you plan on moving.
While the backup is running, document the shares that you plan on moving. You need the share name and a list of the users with their permissions.
Once you are done documenting, and the backup is complete, you can disable each share you are moving. Give your users plenty of notice, obviously.
After you have all of your shares documented, go to the new server and map a drive letter to the old server's hard drive that you want to copy from.
At this point, ensure no one is using the old server, and disable your anti-virus real-time scanning. Make sure real-time scanning is enabled on the new server, and that your definitions are up to date. HINT: We run this from the new server, because in most cases it's WAY faster than the old one.
Now, open a command prompt, and run the following command:
NET USE T: \\old-server-name\D$
Use whatever drive letter you feel comfortable with, like T: for transfer, or whatever. Make sure you connect to the old server's "Administrative" share, so that you don't have to deal with any permission problems.
Once you've mapped a drive, you can issue the following XCOPY command:
XCOPY [source] [target] /S /E /V /C /H /O
This copies all information from the path, including file permissions, so you don't have to re-set that up.
If you want to copy an entire drive in one pass, which I recommend, the command would look like this: (assuming you mapped the old server's
drive to letter T:)
XCOPY T:\*.* D:\ /S /E /V /C /H /O
This is the simplest and fastest way to transfer everything.
Now, one caveat… the /C switch says to "continue copying even if there are errors" … it's very important to use this, or your copy might hit an error and STOP partway through, with you having to start all over.
However, if there ARE errors, you may not get every file from the old drive. That's why it's important to leave the old data around for a couple of weeks, or months, in case someone comes to you and says something like "this was in my home directory, and now it's not."
That's about it. Send me feedback on whether or not you liked this article!