<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Robocopy on Di</title>
        <link>https://dixu.ddns.net/tags/robocopy/</link>
        <description>Recent content in Robocopy on Di</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en-us</language>
        <lastBuildDate>Sun, 11 Oct 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://dixu.ddns.net/tags/robocopy/index.xml" rel="self" type="application/rss+xml" /><item>
            <title>Migrate and Replace a Windows Data Drive</title>
            <link>https://dixu.ddns.net/p/migrate-and-replace-a-windows-data-drive/</link>
            <pubDate>Sun, 11 Oct 2026 14:10:18 -0400</pubDate>
            <guid>https://dixu.ddns.net/p/migrate-and-replace-a-windows-data-drive/</guid>
            <description>&lt;p&gt;&lt;a class=&#34;link&#34; href=&#34;https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy&#34;  title=&#34;Microsoft Learn&#34;&#xA;     target=&#34;_blank&#34; rel=&#34;noopener&#34;&#xA;    &gt;Robocopy Command Reference&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a class=&#34;link&#34; href=&#34;https://learn.microsoft.com/en-us/windows-server/storage/disk-management/change-a-drive-letter&#34;  title=&#34;Microsoft Learn&#34;&#xA;     target=&#34;_blank&#34; rel=&#34;noopener&#34;&#xA;    &gt;Change a Drive Letter&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;before-you-start&#34;&gt;Before You Start&#xA;&lt;/h2&gt;&lt;p&gt;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.&lt;/p&gt;&#xA;&lt;p&gt;The examples use these drive letters:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Drive&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Role&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;D:&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Original drive (source)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;E:&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Replacement drive (destination)&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Back up important files before starting. Confirm which physical disk is the replacement drive, assign it &lt;code&gt;E:&lt;/code&gt;, and check that it has enough free space for the source data. Replace the example drive letters with the actual assignments on your computer.&lt;/p&gt;&#xA;&lt;p&gt;If the replacement volume needs formatting, use NTFS to support the metadata copied below. &lt;strong&gt;Formatting erases all existing data on the selected volume.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Open &lt;strong&gt;Command Prompt&lt;/strong&gt; as administrator for the Robocopy commands.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Check the source and destination before every copy.&lt;/strong&gt; &lt;code&gt;/MIR&lt;/code&gt; removes destination files and directories that are absent from the source. Use a destination dedicated to this migration.&lt;/p&gt;&#xA;&lt;h2 id=&#34;copy-the-data&#34;&gt;Copy the Data&#xA;&lt;/h2&gt;&lt;p&gt;Run the initial copy:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;robocopy D:\ E:\ /MIR /COPYALL /DCOPY:DAT /R:2 /W:2 /XJ /MT:16 /LOG:C:\drive-migration.log&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Option&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;Purpose&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/MIR&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Mirror the directory tree, including empty directories; remove destination-only entries.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/COPYALL&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Copy file data, attributes, timestamps, permissions, ownership, and auditing information.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/DCOPY:DAT&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Copy directory data, attributes, and timestamps.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/R:2&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Retry a failed copy twice.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/W:2&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Wait two seconds between retries.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/XJ&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Exclude junction points.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/MT:16&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Use 16 copy threads.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;code&gt;/LOG:&lt;/code&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;Write output to a log file, replacing an existing log at that path.&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Junction points excluded by &lt;code&gt;/XJ&lt;/code&gt; need separate review and recreation if they are part of your setup. This is a file migration, not a sector-by-sector disk clone.&lt;/p&gt;&#xA;&lt;h2 id=&#34;monitor-progress&#34;&gt;Monitor Progress&#xA;&lt;/h2&gt;&lt;p&gt;While the copy runs, open a separate PowerShell window:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-powershell&#34; data-lang=&#34;powershell&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;Get-Content&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;C:&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;\&lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;drive-migration&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;py&#34;&gt;log&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;-Tail&lt;/span&gt; &lt;span class=&#34;mf&#34;&gt;20&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;-Wait&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Press &lt;code&gt;Ctrl+C&lt;/code&gt; in this window to stop monitoring. The copy continues in the Command Prompt window.&lt;/p&gt;&#xA;&lt;h2 id=&#34;synchronize-the-final-changes&#34;&gt;Synchronize the Final Changes&#xA;&lt;/h2&gt;&lt;p&gt;After the initial copy finishes, close applications and stop services that write to &lt;code&gt;D:&lt;/code&gt;, including synchronization tools. Keep them stopped until the replacement is complete.&lt;/p&gt;&#xA;&lt;p&gt;Run a final copy to capture changes made during the initial pass:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;robocopy D:\ E:\ /MIR /COPYALL /DCOPY:DAT /R:2 /W:2 /XJ /MT:16 /LOG:C:\drive-migration-final.log&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Immediately after each copy, check its exit code in the same Command Prompt window:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;echo&lt;/span&gt; &lt;span class=&#34;nv&#34;&gt;%ERRORLEVEL%&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;An exit code of &lt;code&gt;8&lt;/code&gt; or greater indicates at least one copy failure. Lower codes can still report differences; review the log summary and resolve failures before continuing.&lt;/p&gt;&#xA;&lt;h2 id=&#34;verify-the-copy&#34;&gt;Verify the Copy&#xA;&lt;/h2&gt;&lt;p&gt;Run a comparison without changing either drive:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-cmd&#34; data-lang=&#34;cmd&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;robocopy D:\ E:\ /MIR /COPYALL /DCOPY:DAT /R:2 /W:2 /XJ /L /LOG:C:\drive-migration-verify.log&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;/L&lt;/code&gt; lists proposed operations without copying, deleting, or updating timestamps. Review any remaining differences and open a sample of important files from &lt;code&gt;E:&lt;/code&gt;. This comparison is not a checksum-based integrity check.&lt;/p&gt;&#xA;&lt;h2 id=&#34;replace-the-original-drive-letter&#34;&gt;Replace the Original Drive Letter&#xA;&lt;/h2&gt;&lt;p&gt;Once verification is complete, use Disk Management to make the replacement drive available at the original path:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Confirm that applications and services using &lt;code&gt;D:&lt;/code&gt; are stopped.&lt;/li&gt;&#xA;&lt;li&gt;Open &lt;strong&gt;Disk Management&lt;/strong&gt; as administrator.&lt;/li&gt;&#xA;&lt;li&gt;Right-click the original data volume and select &lt;strong&gt;Change Drive Letter and Paths&lt;/strong&gt;. Change &lt;code&gt;D:&lt;/code&gt; to an unused letter, such as &lt;code&gt;F:&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Change the replacement volume from &lt;code&gt;E:&lt;/code&gt; to &lt;code&gt;D:&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Restart the affected applications and services, then check their paths and file access.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;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.&lt;/p&gt;&#xA;</description>
        </item></channel>
</rss>
