Computer >> Computer tutorials >  >> System >> Windows Server

How to Move (Clone) Windows to a New Hard Drive (HDD/SSD)?

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.

Note that you will be able to clone an operation system by copying it to a new disk only if you migrate it on the same computer (or two computers with similar hardware). If you want to copy an installed Windows to a disk for another computer, you will have to get new drivers for disk controllers, chipset and videocard to boot the OS on a new hardware.

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.

How to Move (Clone) Windows to a New Hard Drive (HDD/SSD)?

  • 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

How to Move (Clone) Windows to a New Hard Drive (HDD/SSD)?

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).

If there are some partitions on the drive, you can change the type of your partition table from MBR to GPT without data loss using the mbr2gpt.exe tool built into Windows 10.

Use the following commands for BIOS MBR:

convert mbr
create partition primary align=1024
active
format fs="NTFS" quick label="NEW_SYSTEM"
exit

How to Move (Clone) Windows to a New Hard Drive (HDD/SSD)?

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.

If the disk letters are not assigned, you can fix it in diskpart as follows:
select disk 1
list part
select part 1
assign
list volume

How to Move (Clone) Windows to a New Hard Drive (HDD/SSD)?

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

How to Move (Clone) Windows to a New Hard Drive (HDD/SSD)?

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.

If you try to boot from the new disk without fixing the boot records, the Operation system not found error will appear.

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

How to Move (Clone) Windows to a New Hard Drive (HDD/SSD)?

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

How to Move (Clone) Windows to a New Hard Drive (HDD/SSD)?

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.

How to Move (Clone) Windows to a New Hard Drive (HDD/SSD)?

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).

How to Move (Clone) Windows to a New Hard Drive (HDD/SSD)?

The article doesn’t describe how to create a boot record for Windows Recovery Environment. Usually it is located on a separate System Reserved partition. If you want to configure Windows Recovery Environment (WinRE), follow the instructions in this article.