Before You Start
Use Robocopy to migrate files from a Windows data drive to a replacement drive, then assign the original drive letter to the replacement. These commands migrate files; they do not clone a Windows system or boot drive.
The examples use these drive letters:
| Drive | Role |
|---|---|
D: |
Original drive (source) |
E: |
Replacement drive (destination) |
Back up important files before starting. Confirm which physical disk is the replacement drive, assign it E:, and check that it has enough free space for the source data. Replace the example drive letters with the actual assignments on your computer.
If the replacement volume needs formatting, use NTFS to support the metadata copied below. Formatting erases all existing data on the selected volume.
Open Command Prompt as administrator for the Robocopy commands.
Check the source and destination before every copy. /MIR removes destination files and directories that are absent from the source. Use a destination dedicated to this migration.
Copy the Data
Run the initial copy:
robocopy D:\ E:\ /MIR /COPYALL /DCOPY:DAT /R:2 /W:2 /XJ /MT:16 /LOG:C:\drive-migration.log
| Option | Purpose |
|---|---|
/MIR |
Mirror the directory tree, including empty directories; remove destination-only entries. |
/COPYALL |
Copy file data, attributes, timestamps, permissions, ownership, and auditing information. |
/DCOPY:DAT |
Copy directory data, attributes, and timestamps. |
/R:2 |
Retry a failed copy twice. |
/W:2 |
Wait two seconds between retries. |
/XJ |
Exclude junction points. |
/MT:16 |
Use 16 copy threads. |
/LOG: |
Write output to a log file, replacing an existing log at that path. |
Junction points excluded by /XJ need separate review and recreation if they are part of your setup. This is a file migration, not a sector-by-sector disk clone.
Monitor Progress
While the copy runs, open a separate PowerShell window:
Get-Content C:\drive-migration.log -Tail 20 -Wait
Press Ctrl+C in this window to stop monitoring. The copy continues in the Command Prompt window.
Synchronize the Final Changes
After the initial copy finishes, close applications and stop services that write to D:, including synchronization tools. Keep them stopped until the replacement is complete.
Run a final copy to capture changes made during the initial pass:
robocopy D:\ E:\ /MIR /COPYALL /DCOPY:DAT /R:2 /W:2 /XJ /MT:16 /LOG:C:\drive-migration-final.log
Immediately after each copy, check its exit code in the same Command Prompt window:
echo %ERRORLEVEL%
An exit code of 8 or greater indicates at least one copy failure. Lower codes can still report differences; review the log summary and resolve failures before continuing.
Verify the Copy
Run a comparison without changing either drive:
robocopy D:\ E:\ /MIR /COPYALL /DCOPY:DAT /R:2 /W:2 /XJ /L /LOG:C:\drive-migration-verify.log
/L lists proposed operations without copying, deleting, or updating timestamps. Review any remaining differences and open a sample of important files from E:. This comparison is not a checksum-based integrity check.
Replace the Original Drive Letter
Once verification is complete, use Disk Management to make the replacement drive available at the original path:
- Confirm that applications and services using
D:are stopped. - Open Disk Management as administrator.
- Right-click the original data volume and select Change Drive Letter and Paths. Change
D:to an unused letter, such asF:. - Change the replacement volume from
E:toD:. - Restart the affected applications and services, then check their paths and file access.
Applications installed on the drive may require additional repair or configuration after a drive-letter change. Keep the original drive intact until the replacement works as expected.