Is it possible to make a full image backup of an SSD on Windows?
Nov 14
Recently, I've moved from a Mac to a PC laptop. I already used Windows on the MacBook with Parallels. Because it was a virtual machine, I could make a complete backup by just copying the virtual machine file. When I needed to restore a previous version of the machine, I just had to paste the old file on the same place.
This was very convenient, because, as a software developer, it's always a hassle to configure a new environment; usually I lose days doing things such installing apps, configure, personalizing and so on.
Is there an effective way to make full image of the SSD, so if I need to restore it in the future, I just restore the image? This would mean to restore the exact settings, apps, data, everything, just like I used to do on Parallels, but on a regular Windows laptop.
1 answer
Accepted answer · original discussion
Nov 18
If Windows isn't being run within a VM, full disk images are ill-advised because they're literally not needed unless deploying to multiple machines specifically via FFU images; outside of that, there's literally no use case for partition-level or disk-level images within Windows since Win ≥ XP uses NTFS as the default filesystem (specific to this question, the OS partition is the only partition needing to be imaged).
Due to this, and excluding FFU images, a conventional partition-level or disk-level image containing offset, alignment, block size, etc. isn't required in Windows, and they:
- lack native Windows support and therefore require third-party programs and non-standard Windows boot media
- often lack compression and parity, the main advantages of the Windows Image file format
- WIMs/ESDs can contain multiple images within a relatively small single image file, with data impossible to corrupt provided
/CheckIntegrityand/Verifyare always used
- WIMs/ESDs can contain multiple images within a relatively small single image file, with data impossible to corrupt provided
- lock the image to that specific partition or drive layout (offset, alignment, block size, etc.)
- often have no data verification, therefore are subject to data corruption
Imaging
PowerShell Mapping | Win ≥ 8: Dism | Win ≤ 7: ImageX
The initial base WIM/ESD does take longer to capture than third-party cloning because parity is built-in to the WIM/ESD file format; after the base image, subsequent appended images take less time. A WIM/ESD can contain multiple images within a relatively small single image file, with data impossible to corrupt provided /CheckIntegrity and /Verify are always used
- WIMs (Windows IMage) can capture an entire partition or individual folders/files
- ESDs (Electronic Software Distribution) can only capture an OS partition and must use
/Compress:Recovery(algorithm is ~33% more efficient than/Compress:Max)- Windows ≥ 10: Can only be used for PBR [Push-Button Reset] exported images
- Windows ≤ 8.1: Can be used on a bootable Windows install or a PBR image
- Specify exclusions or exceptions by creating a
WimScript.iniconfig file, with/ScratchDirbeing required in WinPE since it only has 32MB of scratch [temp] space by default- To negate the need of
/ScratchDir, see section WinPE/WinRE Customizations
- To negate the need of
- Even though
/CheckIntegrity(ImageX:/Check) and/Verifydo extend the image processing time, they should always be used since they prevent data corruption from occurring within the WIM/ESD
Prerequisites
- Boot to WinRE: (OS partition can only be captured from WinPE)
- Identify the mount point of the offline OS partition: (it's likely not
C:)
Capture Image OR Append Image
- Either:
- Capture a base image:
# Mount Points: # C: offline OS partition # Z: partition WIM is being saved to # Windows ≥8: DISM Dism /Capture-Image /ImageFile:"Z:\Base.wim" /CaptureDir:"C:" /Name:"Windows Backup" /Description:"Base Image 2023.11.17 @ 12:00" /Compress:Max /CheckIntegrity /Verify /ScratchDir:"Z:" # Windows XP ≤ 7: ImageX ImageX /Capture "C:" "Z:\Base.esd" "Windows Backup" "Base Image 2023.11.17 @ 12:00" /Compress:Recovery /Check /Verify /ScratchDir:"Z:\"- Mechanical HDD: since compression takes longer if using
/Compress:<Max||Recovery>, if time's an issue, it's more efficient to use/Compress:Fast, exporting the index later usingMaxorRecovery
- Mechanical HDD: since compression takes longer if using
- Append an image to an existing WIM:
# Mount Points # C: offline OS partition # Z: partition containing the WIM # Windows ≥8: DISM Dism /Append-Image /ImageFile:"Z:\Base.wim" /CaptureDir:"C:" /Name:"Windows Backup" /Description:"Appended Image 2023.11.17 @ 12:00" /CheckIntegrity /Verify /ScratchDir:"Z:" # Windows XP ≤ 7: ImageX ImageX /Append "C:" "Z:\Base.esd" "Windows Backup" "Appended Image 2023.11.17 @ 12:00" /Compress:Recovery /Check /Verify /ScratchDir:"Z:\"- Compression is locked to the value set when the base image was captured
- Individual indexes can be deleted via
/Delete-Imageor exported to their own WIM/ESD via/Export-Image
- Capture a base image:
Apply Image
- Format the offline OS partition:
DiskPart→lis dis→sel dis #→lis par→sel par #- Verify correct partition selected:
det par format fs=ntfs quick label=OS→det par- If mount point [
Ltr] still exists →exit; if not:assign letter=O→exitVolume ### Ltr Label Fs Type Size Status Info ---------- --- ----------- ----- ---------- ------- --------- -------- * Volume 8 O OS NTFS Partition 300 GB Healthy Boot
/Get-ImageInfoto ensure correct index [image] is being applied:# Windows ≥8: DISM Dism /Get-ImageInfo /ImageFile:"Z:\Base.wim" # Windows XP ≤ 7: ImageX ImageX /Info "Z:\Base.wim"
- Apply image to the offline OS partition:
# Mount Points # C: offline OS partition image is being applied to # Z: partition containing the WIM # Windows ≥8: DISM Dism /Apply-Image /ImageFile:"Z:\Base.wim" /Index:1 /ApplyDir:"C:" /CheckIntegrity /Verify /ScratchDir:"Z:" # Windows XP ≤ 7: ImageX ImageX /Apply "Z:\Base.wim" 1 "C:" /Check /Verify /ScratchDir:"Z:\"
BootRecmust be run prior to exiting WinPE/WinRE:- BIOS:
BootRec /FixMBR && BootRec /FixBoot && BootRec /RebuildBCD - UEFI:
::# With existing bootable EFI partition: BootRec /FixMBR && BootRec /RebuildBCD ::# Without existing bootable EFI partition: ::# Create EFI directories and enter: MkDir "Y:\EFI\Microsoft\Boot" Cd /d "Y:\EFI\Microsoft\Boot" ::# Create EFI boot structure: BootRec /Fixboot ::# If Access Denied error occurs (C: is applied image): BcdBoot C:\Windows /s Y: /f UEFI ::# Resolve any other boot issues: BootRec /FixMBR && BootRec /RebuildBCD
- BIOS:
Appended WIM Example
PS $ ls -file "Z:\WIM"
Directory: Z:\WIM
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2023.09.05 00:33:46 40,193,295,546B Base.wim
-a---- 2023.09.05 00:07:12 568B Dism.cmd
-a---- 2023.09.05 00:09:51 97B WimScript.ini
PS $ Dism /Get-ImageInfo /ImageFile:"Z:\WIM\base.wim"
Deployment Image Servicing and Management tool
Version: 10.0.22621.1
Details for image : Z:\WIM\base.wim
Index : 1
Name : Alienware 18: Windows 11
Description : v22H2: Base (Drivers & Updates Only)
Size : 48,259,986,179 bytes
Index : 2
Name : Alienware 18: Windows 11
Description : v22H2: Programs Installed (Customizations Applied)
Size : 74,666,504,006 bytes
PS $ Dism /Get-ImageInfo /ImageFile:"Z:\WIM\base.wim" /Index:1
Deployment Image Servicing and Management tool
Version: 10.0.22621.1
Details for image : Z:\WIM\base.wim
Index : 1
Name : Alienware 18: Windows 11
Description : v22H2: Base (Drivers & Updates Only)
Size : 48,259,986,179 bytes
WIM Bootable : No
Architecture : x64
Hal : COMPUTER\Generic
Version : 10.0.22621
ServicePack Build : 2215
ServicePack Level : 0
Edition : Professional
Installation : Client
ProductType : WinNT
ProductSuite : Terminal Server
System Root : WINDOWS
Directories : 48508
Files : 195745
Created : 2023.08.28 - 22:09:33
Modified : 2023.08.28 - 22:09:34
Languages : en-US (Default)
PS $ Dism /Get-ImageInfo /ImageFile:"Z:\WIM\base.wim" /Index:2
Deployment Image Servicing and Management tool
Version: 10.0.22621.1
Details for image : Z:\WIM\base.wim
Index : 2
Name : Alienware 18: Windows 11
Description : v22H2: Programs Installed (Customizations Applied)
Size : 74,666,504,006 bytes
WIM Bootable : No
Architecture : x64
Hal : COMPUTER\Generic
Version : 10.0.22621
ServicePack Build : 2215
ServicePack Level : 0
Edition : Professional
Installation : Client
ProductType : WinNT
ProductSuite : Terminal Server
System Root : WINDOWS
Directories : 60460
Files : 275154
Created : 2023.09.04 - 23:30:09
Modified : 2023.09.04 - 23:30:10
Languages : en-US (Default)
Configure New Drive
DiskPart:
UEFI:::# List disks: Lis Dis ::# Select OS drive # WIM is being applied to: Sel Dis # ::# Wipe partition table (assumes no data on drive is being preserved) CleanConvert Gpt
- Create boot partition:
- BIOS:
Cre Par Pri Offset=1024 Size=100 Format Quick Fs=NTFS Label=Boot Active - UEFI:
Cre Par EFI Offset=1024 Size=100 Format Quick Fs=FAT32 Label=EFI Assign Letter=Y Cre Par Msr Size=16
- BIOS:
- Create System partition:
- Rest of the drive as the System partition:
IfC:can't be assigned, change 3 & 5 to another letter- BIOS:
Cre Par Pri Format Quick Fs=NTFS Label=System Exit - UEFI:
Cre Par Pri Id=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 Format Quick Fs=NTFS Label=System Assign Letter=C Exit
- BIOS:
- Additional partitions after the [200GB] System partition:
If storing User Data directories on a partition other thanC:\(recommended), max size required is ~300GB (multiply size wanted by 1024:200*1024=204800)- BIOS:
Cre Par Pri Size=204800 Format Quick Fs=NTFS Label=System Exit - UEFI:
Cre Par Pri Size=204800 Id=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 Format Quick Fs=NTFS Label=System Assign Letter=C Exit
- BIOS:
- Rest of the drive as the System partition:
- Create WinRE partition: (should have 320MB free to allow for future WIM size increases)
- BIOS:
Shrink Desired=665 Minimum=650 Cre Par Pri id=27 Format Quick Fs=NTFS Label=WinRE - UEFI:
Shrink Desired=665 Minimum=650 Cre Par Pri Id=de94bba4-06d1-4d40-a16a-bfd50179d6ac Format Quick Fs=NTFS Label=WinRE Gpt Attributes=0x8000000000000001
- BIOS:
- Resolve any boot issues: (once WIM has been applied)
- BIOS:
BootRec /FixMBR && BootRec /FixBoot && BootRec /RebuildBCD - UEFI:
::# With existing bootable EFI partition: BootRec /FixMBR && BootRec /RebuildBCD ::# Without existing bootable EFI partition: ::# Create EFI directories and enter: MkDir "Y:\EFI\Microsoft\Boot" Cd /d "Y:\EFI\Microsoft\Boot" ::# Create EFI boot structure: BootRec /Fixboot ::# If Access Denied error occurs (C: is applied image): BcdBoot C:\Windows /s Y: /f UEFI ::# Resolve any other boot issues: BootRec /FixMBR && BootRec /RebuildBCD
- BIOS:
- Remove EFI mountpoint and Reboot:
DiskPart Sel Vol Y Remove Exit
WinPE/WinRE Customizations
To increase the temp space available in WinPE/WinRE, negating the need for /ScratchDir:
WinPE
- Open an Admin terminal: +R → Open:
powershell→ Ctrl+Shift+OK -
## <InstallUSB>: drive letter for the Install USB ## # Create working directory: MkDir "C:\Mount" # Get correct image index (Windows Setup is usually #2): Dism /Get-ImageInfo /ImageFile:"<InstallUSB>:\sources\boot.wim" # Mount WinPE Windows Setup WIM: Dism /Mount-Image /ImageFile:"<InstallUSB>:\sources\boot.wim" /Index:2 /MountDir:"C:\Mount" # Load WinPE SYSTEM hive: Reg Load HKLM\WinPE "C:\Mount\Windows\System32\config\SYSTEM" # Show hidden files: Reg Add HKLM\WinPE\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v Hidden /t REG_DWORD /d 1 Reg Add HKLM\WinPE\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v ShowSuperHidden /t REG_DWORD /d 1 # Show file extensions: Reg Add HKLM\WinPE\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v HideFileExt /t REG_DWORD /d 0 # Unload Hive: Reg Unload HKLM\WinPE # Set WinPE default temp space to 512MB: Dism /Set-ScratchSpace:512 /Image:"C:\Mount" # Unmount WinPE Windows Setup WIM: Dism /Unmount-Image /MountDir:"C:\Mount" /Commit # Cleanup: RmDir /s /q "C:\Mount"
WinRE
- Open an Admin terminal: +R → Open:
powershell→ Ctrl+Shift+OK - Mount WinRE partition:
DiskPart→lis vol→sel vol #→det vol→assign letter=W→exit -
# Create working directory: MkDir "C:\Mount" # Mount WinRE WIM: Dism /Mount-Image /ImageFile:"W:\Recovery\WindowsRE\winre.wim" /Index:1 /MountDir:"C:\Mount" # Load WinRE SYSTEM hive: Reg Load HKLM\WinRE "C:\Mount\Windows\System32\config\SYSTEM" # Show hidden files: Reg Add HKLM\WinRE\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v Hidden /t REG_DWORD /d 1 Reg Add HKLM\WinRE\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v ShowSuperHidden /t REG_DWORD /d 1 # Show file extensions: Reg Add HKLM\WinRE\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v HideFileExt /t REG_DWORD /d 0 # Unload Hive: Reg Unload HKLM\WinRE # Set WinRE default temp space to 512MB: Dism /Set-ScratchSpace:512 /Image:"C:\Mount" # Unmount WinRE WIM: Dism /Unmount-Image /MountDir:"C:\Mount" /Commit # Cleanup: RmDir /s /q "C:\Mount" - Unmount WinRE partition:
DiskPart→sel vol W→remove→exit
3 question comments
Use comments to ask for clarification. Post a solution as an answer.
Nov 15
Dism to capture or apply the image (WIMs provide parity to ensure there's no data corruption between capturing the image and applying the image). To do so, see Imaging numbers 1 for Capturing, 2 for Applying (prior to applying an OS WIM, the OS partition would be formatted via DiskPart). Provided the WIM is being applied to a machine with a bootable Windows boot partition, the only other step before rebooting is BootRec /FixMBR && BootRec /RebuildBCDNov 16