You'll need to boot to WinRE or WinPE (Windows Setup Media) and perform the following:
- Capture a WIM of the original drive's partitions via
DISM
- Required partitions: OS & WinRE
- Optional partitions: OEM tools and Recovery Image partition(s)
- Configure partition layout of the new drive
- Apply each captured WIM to the corresponding new drive's partitions
Imaging
- Windows has always natively supported imaging of partitions or individual directories.
- The system partition can only be imaged from WinPE/WinRE, while all other partitions are able to be imaged while booted to Windows.
- WIMs (Windows IMage) can be captured of an entire partition or individual folders/files and is the best method to use (specify exclusions/exceptions in a
WimScript.ini
file)
- All WinPE/WinRE WIMs have
DISM
included within them.
- WinPE: Windows Preinstallation Environment
- Such as a Windows Setup boot media (SHIFT + F10 to access terminal)
- WinRE: Windows Recovery Environment
Commands
WinPE only has 32MB of scratch [temp] space by default, so /ScratchDir
is required
Capture an image:
dism /Capture-Image /ImageFile:"Z:\Base.wim" /CaptureDir:"C:" /Name:"Windows Backup" /Description:"Base Image 2020.02.15 @ 07:59" /Compress:Max /CheckIntegrity /Verify /NoRpFix /ScratchDir:"Z:\"
Append an Image:
dism /Append-Image /ImageFile:"Z:\Base.wim" /CaptureDir:"C:" /Name:"Windows Backup" /Description:"Base Image 2020.02.15 @ 07:59" /Compress:Max /CheckIntegrity /Verify /NoRpFix /ScratchDir:"Z:\"
Apply an image:
dism /Apply-Image /ImageFile:"Z:\Base.wim" /Index:1 /ApplyDir:"C:" /CheckIntegrity /Verify /NoRpFix /ScratchDir:"Z:\"
If applying a system image, the following commands must be issued prior to booting:
bootrec /FixMBR && bootrec /RebuildBCD
NOTE:
- It's impossible for an ESD/WIM image to become corrupted
- Provided imaging commands are always issued with:
/CheckIntegrity
& /Verify
- ESDs can only be taken of a system partition
/Compress:Recovery
is the only compression algorithm available.
- ESD compression ratio is ~33% more efficient than the WIM compression ratio.
- In Windows 10, Microsoft only allows ESDs for Push-Button Reset exported images
- ESDs/WIMs are smart compression image formats
- Only changed files are added to an image when a new image is appended to it
- Newly appended images utilize the same copy of unchanged files already contained within the image from the previous image(s).
- This allows for an image to remain small in relation to the data contained within.
Configure Partitions
- Boot to WinRE or WinPE:
- WinRE: Settings > Update & Security > Recovery - Advanced Startup >
Troubleshoot > Advanced > Command Prompt
- WinPE: Boot Windows Setup Media and open a terminal via SHIFT + F10
- Issue the following commands:
diskpart
lis dis
sel dis X
- Where
X
is the # of the new drive
clean
convert gpt
cre par pri size=665 id=de94bba4-06d1-4d40-a16a-bfd50179d6ac offset=1024
- WinRE partition must have 320MB free (
WinRE.wim
is ~300MB in size)
format quick fs=ntfs label=WinRE
gpt attributes=0x8000000000000001
cre par efi size=100
format quick fs=fat32 label=EFI
cre par msr size=16
- If wanting:
- Rest of the disk as the system partition:
cre par pri id=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
format fs=ntfs quick label=System
- To create additional partitions after the System partition
cre par pri size=204800 id=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
- Creates 200GB System partition, w/ max size required being ~300GB if storing User Data directories on a partition other than
C:\
(recommended)
(i.e %UserProfile%\Documents
, %UserProfile%\Downloads
, etc.)
- Multiply partition size wanted by 1024 (i.e.
200*1024=204800
)
format fs=ntfs quick label=System
- Close DiskPart:
exit
- Follow this guide to recreate the EFI partition's boot contents
- Another way is to close the terminal and proceed through Windows setup
- Select the 4th partition you created to install Windows to (partition from 2.12.1 || 2.12.2)
- Once setup reaches the "Installing Features" step, cancel the install
- Setup can likely be canceled sooner, however, I'm not sure at which point it configures the EFI partition with the boot files, which is the only reason you're utilizing Windows Setup.
- Capture and Apply the System, WinRE, and any desired OEM partitions from the previous disk, utilizing the commands under Imaging
- If using the option in 3.1, before applying the WIM of the system partition to the new drive, format the System partition on the drive (partition #4 from 2.12 above):
diskpart
> lis vol
> sel vol <X>
> format fs=ntfs quick label=System
DISM Prerequisites
- Easy
- Download & create a bootable USB via the Windows Media Creation Tool
- Once booted from it, press: SHIFT + F10 to open a terminal
- DISM commands
- Custom: Create a WinPE/RE image
- Install:
- Windows ADK (8 & 10) is specific to the version of Windows installed.
- Create:
- Boot it
Example: /Get-WIMinfo
PS $ ls -File "Z:\WIM"
Directory: Z:\WIM
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2018.12.24 03:34:13 95,019,530,773B Base.wim
-a---- 2016.06.14 22:32:36 568B DISM.cmd
-a---- 2016.05.17 05:36:10 97B wimscript.ini
PS $ dism /Get-WIMinfo /WIMfile:"Base.wim"
Deploy Image Servicing and Management tool
Version: 10.0.18362.1
Details for image : "Base.wim"
Index : 1
Name : Alienware 18: Windows 10
Description : v1803: Base (Drivers Only)
Size : 22,710,283,446 bytes
Index : 2
Name : Alienware 18: Windows 10
Description : v1803: Software Installed (No Customizations)
Size : 45,591,850,754 bytes
Index : 3
Name : Alienware 18: Windows 10
Description : v1803: Software Installed (Customized)
Size : 94,958,267,312 bytes
Index : 4
Name : Alienware 18: Windows 10
Description : v1803: Software Group 1 Installed (Customized)
Size : 101,588,267,910 bytes
Index : 5
Name : Alienware 18: Windows 10
Description : v1803: Software Group 2 Installed (Customized)
Size : 101,905,314,237 bytes
Index : 6
Name : Alienware 18: Windows 10
Description : v1809: Updated Applications
Size : 114,959,954,040 bytes
The operation completed successfully.
PS $ dism /Get-WIMinfo /WIMfile:"Base.wim" /Index:1
Deployment Image Servicing and Management tool
Version: 10.0.18362.1
Details for image : "Base.wim"
Index : 1
Name : Alienware 18: Windows 10
Description : v1803: Base (Drivers Only)
Size : 22,710,283,446 bytes
WIM Bootable : No
Architecture : x64
Hal : acpiapic
Version : 10.0.17134
ServicePack Build : 1
ServicePack Level : 1
Edition : Professional
Installation : Client
ProductType : WinNT
ProductSuite : Terminal Server
System Root : WINDOWS
Directories : 24288
Files : 112665
Created : 2018.05.05 - 13:56:47
Modified : 2018.05.05 - 13:56:47
Languages :
en-US (Default)
The operation completed successfully.
PS $ dism /Get-WIMinfo /WIMfile:"Base.wim" /Index:2
Deployment Image Servicing and Management tool
Version: 10.0.18362.1
Details for image : "Base.wim"
Index : 2
Name : Alienware 18: Windows 10
Description : v1803: Software Installed (No Customizations)
Size : 45,591,850,754 bytes
WIM Bootable : No
Architecture : x64
Hal : acpiapic
Version : 10.0.17134
ServicePack Build : 1
ServicePack Level : 1
Edition : Professional
Installation : Client
ProductType : WinNT
ProductSuite : Terminal Server
System Root : WINDOWS
Directories : 45803
Files : 203058
Created : 2018.05.06 - 01:55:47
Modified : 2018.05.06 - 01:55:48
Languages :
en-US (Default)
The operation completed successfully.
PS $ dism /Get-WIMinfo /WIMfile:"Base.wim" /Index:3
Deployment Image Servicing and Management tool
Version: 10.0.18362.1
Details for image : "Base.wim"
Index : 3
Name : Alienware 18: Windows 10
Description : v1803: Software Installed (Customized)
Size : 94,958,267,312 bytes
WIM Bootable : No
Architecture : x64
Hal : acpiapic
Version : 10.0.17134
ServicePack Build : 1
ServicePack Level : 81
Edition : Professional
Installation : Client
ProductType : WinNT
ProductSuite : Terminal Server
System Root : WINDOWS
Directories : 62409
Files : 350446
Created : 2018.06.01 - 19:09:51
Modified : 2018.06.19 - 21:26:18
Languages :
en-US (Default)
The operation completed successfully.
PS $ dism /Get-WIMinfo /WIMfile:"Base.wim" /Index:4
Deployment Image Servicing and Management tool
Version: 10.0.18362.1
Details for image : "Base.wim"
Index : 4
Name : Alienware 18: Windows 10
Description : v1803: Software Group 1 Installed (Customized)
Size : 101,588,267,910 bytes
WIM Bootable : No
Architecture : x64
Hal : acpiapic
Version : 10.0.17134
ServicePack Build : 1
ServicePack Level : 81
Edition : Professional
Installation : Client
ProductType : WinNT
ProductSuite : Terminal Server
System Root : WINDOWS
Directories : 61908
Files : 346074
Created : 2018.06.08 - 21:54:02
Modified : 2018.06.19 - 21:26:18
Languages :
en-US (Default)
The operation completed successfully.
PS $ dism /Get-WIMinfo /WIMfile:"Base.wim" /Index:5
Deployment Image Servicing and Management tool
Version: 10.0.18362.1
Details for image : "Base.wim"
Index : 5
Name : Alienware 18: Windows 10
Description : v1803: Software Group 2 Installed (Customized)
Size : 101,905,314,237 bytes
WIM Bootable : No
Architecture : x64
Hal : acpiapic
Version : 10.0.17134
ServicePack Build : 1
ServicePack Level : 81
Edition : Professional
Installation : Client
ProductType : WinNT
ProductSuite : Terminal Server
System Root : WINDOWS
Directories : 76113
Files : 423408
Created : 2018.06.09 - 20:38:36
Modified : 2018.06.19 - 21:26:18
Languages :
en-US (Default)
The operation completed successfully.
PS $ dism /Get-WIMinfo /WIMfile:"Base.wim" /Index:6
Deployment Image Servicing and Management tool
Version: 10.0.18362.1
Details for image : "Base.wim"
Index : 6
Name : Alienware 18: Windows 10
Description : v1809: Updated Applications
Size : 114,959,954,040 bytes
WIM Bootable : No
Architecture : x64
Hal : acpiapic
Version : 10.0.17763
ServicePack Build : 195
ServicePack Level : 0
Edition : Professional
Installation : Client
ProductType : WinNT
ProductSuite : Terminal Server
System Root : WINDOWS
Directories : 87659
Files : 452028
Created : 2018.12.24 - 04:27:13
Modified : 2018.12.24 - 04:27:15
Languages :
en-US (Default)
The operation completed successfully.