I bought a new SSD to replace my traditional HDD on my Windows 10 laptop. However, it seems my HDD is 512 bytes per sector (from msinfo32) and I cannot format the SSD to anything less than 4096 bytes per sector. How do I clone the HDD to the SSD? Do I need to format the SSD with 512 bytes per sector and if yes, how? The Windows format action only seems to support 4096 and higher bytes per sector. It seems popular cloning software do not support cloning between disks that have different bytes per sector. Also, the original HDD is 1TB while the SSD is 500GB.
- 193
- 1
- 7
2 Answers
Partition-level/disk-level images [contain offset, alignment, block size, etc.] are simply inefficient as NTFS has been the default filesystem since XP:
- Windows has always natively supported cloning/imaging partitions (Win ≥8:
Dism| Win XP ≤7:ImageX), with the vast majority of Windows users having no need for partition-level/disk-level images
PreReqs:
To clone/image the partition(s) from the old HDD to the new drive's partition(s):
- OS Partition:
This can only be imaged from WinPE/WinRE - Any other partition:
+R → Open: Powershell→ Ctrl+Shift+OK
To boot to WinRE:
- Windows ≥8:
- Settings → Update & Security → Recovery → Advanced Startup → Troubleshooting → Advanced → Command Prompt
- Login/Lock Screen Power Menu → Hold Shift while seleting Restart → Troubleshooting → Advanced → Command Prompt
- Windows 7: F8 at boot → Repair your computer → Command Prompt
Partitioning:
- Create and format new partitions:
DiskPart
UEFI:::# List disks: Lis Dis::# Select OS drive # the image is being applied to: Sel Dis #
::# Wipe partition table (assumes no data on drive is being preserved) Clean
Convert Gpt
- Create boot partition:
- BIOS:
Cre Par Pri Offset=1024 Size=100 Format Quick Fs=NTFS Label=Boot Active - UEFI: (EFI | MSR)
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:
UEFI:Cre Par Pri Format Quick Fs=NTFS Label=System ExitCre Par Pri Id=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 Format Quick Fs=NTFS Label=System Assign Letter=C Exit - Additional data 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:
UEFI:Cre Par Pri Size=204800 Format Quick Fs=NTFS Label=SystemCre Par Pri Size=204800 Id=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 Format Quick Fs=NTFS Label=System Assign Letter=C
- 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 system image 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 (if applicable) and Reboot
UEFI:DiskPartSel Vol Y Remove Exit
Imaging:
Specify exclusions or exceptions by creating a WimScript.ini config file, with /ScratchDir being required in WinPE since it only has 32MB of scratch [temp] space by default:
- Even though
/CheckIntegrity(ImageX:/Check) andVerifydo extend the image processing time, they should always be used since they prevent corruption from occurring within the WIM/ESD
- Either Capture or Append an image:
- Capture a WIM of the HDD's partitions:
# Windows ≥8: DISM Dism /Capture-Image /ImageFile:"Z:\Base.wim" /CaptureDir:"C:" /Name:"Windows Backup" /Description:"Base Image 2021.08.13 @ 09:00" /Compress:Max /CheckIntegrity /Verify /ScratchDir:"Z:"Windows XP ≤ 7: ImageX
ImageX /Capture "C:" "Z:\Base.esd" "Windows Backup" "Base Image 2021.08.13 @ 09:00" /Compress:Recovery /Check /Verify /ScratchDir:"Z:"
- If saving the image to a mechanical HDD, compression takes longer, so if wanting to use
/Compress:Maxor/Compress:Recoveryand time is an issue, it'll be more efficient to use/Compress:Fast, exporting the image later using Max or Recovery - For managing size constraints, images can be split into multiple read-only
.swmfiles via/Split-Image
- If saving the image to a mechanical HDD, compression takes longer, so if wanting to use
- Append Image:
# Windows ≥8: DISM Dism /Append-Image /ImageFile:"Z:\Base.wim" /CaptureDir:"C:" /Name:"Windows Backup" /Description:"Base Image 2021.08.13 @ 09:00" /CheckIntegrity /Verify /ScratchDir:"Z:"Windows XP ≤ 7: ImageX
ImageX /Append "C:" "Z:\Base.esd" "Windows Backup" "Base Image 2021.08.13 @ 09: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 image via/Export-Image
- Capture a WIM of the HDD's partitions:
- Apply Image:
# 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:"
- Prior to applying, get Image Info, ensuring correct index [image] is being applied:
Dism /Get-ImageInfo /ImageFile:"Z:\Base.wim" - If applying an OS image, the following must 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: ::# EFI partition mounted at Y: ::# 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:
- Prior to applying, get Image Info, ensuring correct index [image] is being applied:
Accessing data within a WIM or ESD
- Read-only:
- Mount Image: (as
/ReadOnly)# Windows ≥8: DISM Dism /Mount-Image /ImageFile:"Z:\Base.wim" /Index:2 /MountDir:"C:\Mount" /Optimize /CheckIntegrity /ReadOnlyWindows XP ≤ 7: ImageX
ImageX /Mount "Z:\Base.wim" 2 "C:\Mount" /Check
- In lieu of this, I prefer opening the
.wim/.esdwithin the 7zip GUI
- In lieu of this, I prefer opening the
- Unmount Image: (
/discardchanges)# Windows ≥8: DISM Dism /Unmount-Image /MountDir:"C:\Mount" /CheckIntegrity /DiscardWindows XP ≤ 7: ImageX
ImageX /Unmount "C:\Mount"
- Mount Image: (as
- Make changes, or add data, to an image [index]:
- Mount Image:
# Windows ≥8: DISM Dism /Mount-Image /ImageFile:"Z:\Base.wim" /Index:2 /MountDir:"C:\Mount" /Optimize /CheckIntegrityWindows XP ≤ 7: ImageX
ImageX /MountRW "Z:\Base.wim" 2 "C:\Mount" /Check
- Unmount Image: (
/Commitchanges)# Windows ≥8: DISM Dism /Unmount-Image /MountDir:"C:\Mount" /CheckIntegrity /CommitWindows XP ≤ 7: ImageX
ImageX /Unmount "C:\Mount" /Commit
- If using
DISM, to save changes as a new appended image, add/Append
- If using
- Mount Image:
Additional info:
What is the most efficient, native way to image a Windows partition?
- 9,096
See this very similar question : 512B to 4KiB (Advanced Format) HDD cloning with dd
...and especially Jamie Hanrahan' answer.
You will have to see if you destination SSD is AF (Advanced Format), having 512 bytes emulation (logical sector size of 512).
As for the cloning, you can use Linux's dd if you don't need a log file.
Use ddrescue, or hddsuperclone if you need one.
- 244