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
  • 163
  • 6
  • 2
    "The Windows format action" -- this sounds like you're confusing bytes per disk sector with bytes per filesystem cluster. – u1686_grawity Jun 01 '20 at 07:51
  • Now that you mention it, yes most likely. `msinfo32` shows the SSD to be 4096 bytes per sector. – electrophile Jun 01 '20 at 07:54
  • As you plan cloning your hard drive, no need to format the destination drive. – OuzoPower Aug 11 '21 at 13:17
  • I would recommend to check the [partition alignment](https://superuser.com/questions/132296/how-to-check-the-partition-alignment-on-an-ssd-drive) of the HDD. If the partitions are proper aligned there is no reason to just clone the HDD to the SSD. – Robert Aug 11 '21 at 13:44
  • 1
    @electrophile Windows [natively](https://superuser.com/a/1581804/529800) supports this using `Dism` to capture a WIM of the partition(s) you want to move to the new drive, then apply the WIM to the new partition(s), as the vast majority of Windows users have no need for partition-level or disk-level images since NTFS has been the default filesystem since Windows XP. – JW0914 Aug 11 '21 at 13:48

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
  • 7,052
  • 7
  • 27
  • 48
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
  • 206
  • 1
  • 4
  • 15
  • 1
    I have the perspective it's unacceptable for a Windows user to receive advice to use Linux tools to image Windows, as that's inefficient, forcing the user to rely on not only a non-native boot environment, but also on an image format, unsupported by Windows, both of which over-complicate imaging. _(Ever come across advice telling a BSD or Linux user to boot to Windows or use Wine to back up their data? Normally I'd downvote such advice, but I believe that would be unfair to your answer since I've also posted an answer)_ – JW0914 Aug 13 '21 at 21:19
  • @JW0914: No need to use an image format. Just use a live distro that you boot from the DVD bay or a USB key, and use either a dock, an enclosure or an available SATA cable for the second target drive. Really don't understand where is the problem. This is almost daily operation for me. – OuzoPower Aug 17 '21 at 09:39
  • Because it's inefficient to use Linux to image/clone Windows partitions, both from a time, and data integrity, perspective, which I cover in [this](https://superuser.com/a/1581804/529800) answer: a user must create a LiveCD, boot it, look up commands to issue, check parity w/ another program _(automatically done during WIM/ESD capture)_, then once completed, if a system partition was cloned the user will likely need to boot to WinRE to run `BootRec`. To image from Windows takes less time, has parity, and doesn't require an incompatible boot environment or need for a partition/disk-level clone. – JW0914 Aug 19 '21 at 14:58