2

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.

electrophile
  • 193
  • 1
  • 7

2 Answers2

1

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
    • WinPE: Windows Preinstallation Environment
      Once the Install USB's GUI loads, open a terminal via Shift+F10
    • WinRE: Windows Recovery Environment
  • Any other partition: WinKey+ROpen: PowershellCtrl+Shift+OK

To boot to WinRE:

  • Windows ≥8:
    • SettingsUpdate & SecurityRecoveryAdvanced StartupTroubleshootingAdvancedCommand Prompt
    • Login/Lock Screen Power Menu → Hold Shift while seleting RestartTroubleshootingAdvancedCommand Prompt
  • Windows 7: F8 at boot → Repair your computerCommand Prompt


Partitioning:

  1. Create and format new partitions: DiskPart
    ::# 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

    UEFI:
    Convert Gpt
    

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

  3. Create System partition:
    • Rest of the drive as the System partition:
      If C: 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
      
    • Additional data partitions after the [200GB] System partition:
      If storing User Data directories on a partition other than C:\ (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
      
      UEFI:
      Cre Par Pri Size=204800 Id=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
      Format Quick Fs=NTFS Label=System
      Assign Letter=C
      

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

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


  6. Remove EFI mountpoint (if applicable) and Reboot
    UEFI:
    DiskPart
    

    Sel Vol Y Remove Exit



Imaging:

(Powershell cmdlet)

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) and Verify do extend the image processing time, they should always be used since they prevent corruption from occurring within the WIM/ESD

  1. 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:Max or /Compress:Recovery and 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 .swm files via /Split-Image

    • 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-Image or exported to their own image via /Export-Image

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

Accessing data within a WIM or ESD

  1. Read-only:
    1. Mount Image: (as /ReadOnly)
      # Windows ≥8: DISM
        Dism /Mount-Image /ImageFile:"Z:\Base.wim" /Index:2 /MountDir:"C:\Mount" /Optimize /CheckIntegrity /ReadOnly
      

      Windows XP ≤ 7: ImageX

      ImageX /Mount "Z:\Base.wim" 2 "C:\Mount" /Check

      • In lieu of this, I prefer opening the .wim/.esd within the 7zip GUI
    2. Unmount Image: (/discard changes)
      # Windows ≥8: DISM
        Dism /Unmount-Image /MountDir:"C:\Mount" /CheckIntegrity /Discard
      

      Windows XP ≤ 7: ImageX

      ImageX /Unmount "C:\Mount"


  2. Make changes, or add data, to an image [index]:
    1. Mount Image:
      # Windows ≥8: DISM
        Dism /Mount-Image /ImageFile:"Z:\Base.wim" /Index:2 /MountDir:"C:\Mount" /Optimize /CheckIntegrity
      

      Windows XP ≤ 7: ImageX

      ImageX /MountRW "Z:\Base.wim" 2 "C:\Mount" /Check

    2. Unmount Image: (/Commit changes)
      # Windows ≥8: DISM
        Dism /Unmount-Image /MountDir:"C:\Mount" /CheckIntegrity /Commit
      

      Windows XP ≤ 7: ImageX

      ImageX /Unmount "C:\Mount" /Commit

      • If using DISM, to save changes as a new appended image, add /Append


Additional info:
What is the most efficient, native way to image a Windows partition?

JW0914
  • 9,096
0

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.

OuzoPower
  • 244