In this article we will show how to copy (move) your Windows installation without reinstalling to another hard drive using built-in tools (without any third-party software like Paragon, AOMEI or Acronis). For example, this guide will help you to migrate your Windows from an HDD to a new SSD, clone an installed and configured Windows to another computer (there are some nuances) or a new larger hard drive.
As an example, we will clone an installed Windows 10 to a new drive using a bootable USB stick, command prompt and built-in robocopy
tool.
You can clone a hard drive to a new smaller drive if Windows occupies less space on the current drive than your new drive is in size. Otherwise, you will have to delete/move some files from the source drive. The most often, a question like this arises when migrating to SSDs, which are usually smaller than classic HDDs.
The procedure of migrating Windows to another drive depends on your computer’s firmware: BIOS or UEFI. Run the following command:
msinfo32
If you see Legacy in the BIOS mode value, your computer is using BIOS (or UEFI works in the Legacy/CSM mode). If you see UEFI, you have got a modern computer, and Windows is installed in the UEFI mode.
- If a computer works in the native UEFI mode and uses GPT partition table for a boot drive, I will tag commands for such computers with
UEFI GPT
- If you have an old computer with BIOS or UEFI working in the Legacy mode and the drive partition table is MBR, the commands will be marked as
BIOS MBR
First of all, you must create partition table on your new drive. You can do it directly from running Windows 10 using diskpart. If the disk is new, initialize it with diskmgmt.msc
or using the Initialize-Disk PowerShell cmdlet:
Get-Disk | Where-Object PartitionStyle –Eq 'RAW' | Initialize-Disk
Then create a partition table on the new drive. Open the command prompt as an administrator and run this command:
diskpart
In the diskpart context, run the following commands:
list disk
select disk 1
(depending on the number of the new disk the previous command returned)
clean
Then the commands will differ depending on your platform type.
For UEFI GPT
:
convert gpt
create partition efi size=100
format fs="FAT32" quick label="EFI"
create partition msr size=16
create partition primary
format fs="NTFS" quick label="NEW_SYSTEM"
exit
We have created a GPT partition table, two small service partitions (EFI and MSR) and a large partition occupying all the left space on the new drive (learn more about the GPT partition structure in Windows and EFI partition).
Use the following commands for BIOS MBR
:
convert mbr
create partition primary align=1024
active
format fs="NTFS" quick label="NEW_SYSTEM"
exit
To clone Windows to a new drive, you will need a boot USB stick with a Windows 10 install image (it is easy to create it using MediaCreationTool).
Restart your computer and boot from the Windows 10 install media. When the Windows installation window appears, press Shift+F10
to open the command prompt. Run the following commands:
diskpart
list vol
exit
In the screenshot below, you can see that the E: disk letter is assigned to the original Windows partition on the old drive, and D: is assigned to the large partition (with the NEW_SYSTEM label) on the new drive.
select disk 1
list part
select part 1
assign
list volume
Then copy files from the old drive with the installed Windows to the new one. The easiest way to do it is to use robocopy
. The following robocopy command will copy all symbolic links, files and folders containing attributes, NTFS permissions and file timestamps. The copy log will be saved in the root of the target drive:
robocopy E:\ D:\ /E /COPYALL /COPY:DAT /SL /XJ /R:3 /W:3 /UNILOG:"D:\rcopy.log" /TEE
It may take a long time to copy files depending on the size of your old disk (in my case, it took about an hour to copy a 60 GB disk).
Then you can shut down your computer and remove your old hard drive.
The next step is to configure the Windows bootloader on the new disk.
Boot your computer in Windows installation environment again and open the command prompt (Shift+F10
).
Restore the bootloader on BIOS MBR
device.
Check the disk letter assigned to the new large partition on the drive:
diskpart
list vol
The drive letter C: is assigned.
Copy the BCD bootloader files on the drive C:
bcdboot C:\Windows /S C:
Change the MBR record and update boot entries in the BCD configuration file:
bootrec.exe /FixMbr
bootrec.exe /FixBoot
bootrec.exe /RebuildBcd
Here is how to restore an UEFI GPT
bootloader on a computer (learn more in the article on how to repair EFI Bootloader on Windows 10).
Get the system drive letter and assign a disk letter to the EFI partition.
Diskpart
List vol
In this example, drive letter C is assigned to the system partition. You must assign a letter to the EFI partition (100 MB and FAT32) using the following commands (change the partition numbers according to your configuration):
select volume 1
assign letter M:
exit
Now you need to recreate the BCD bootloader and boot configuration:
cd /d m:\efi\microsoft\boot\
ren BCD BCD.bak
bcdboot c:\Windows /l en-us /s M: /f ALL
Restart your computer and remove the boot USB stick. Make sure that Windows 10 has booted correctly from your new drive.
All installed apps, files and settings remained in place. You have successfully copied an installed Windows 10 to a new drive.
When you copy files to a new disk using robocopy, some errors may occur. Open rcopy.log
on your new drive to see what files have not been copied. In my case, 94 files were not copied (only junk and temporary files were not copied).
5 comments
The title is wrong: it must read “How NOT to clone…”
Thanks, super awesome guide!
Small nit: You should probably change the robocopy command and omit the /COPY:DAT argument (/COPYALL makes it redundant and in fact specifying /COPY:DAT might overwrite the /COPYALL).
Great comment. I have the same observation.
It is easy via using tools like Gs Richcopy 360, Carbonite, or SyncToy, search all
It is a fairly sophisticated rout using intermediator a “bootable USB” +HD
Qn
Having a bootable USB; what are other (system) folders that need to be copied to the bootable USB to make it the C:\ driver
Perhaps i should ask is the above possible..
(namely, moving C: to a USB)
You stand alone by the details you provided. Many thanks, A.