September 2021 Archives

Migrating Windows 10 from 512 byte to 4096 byte sectors

I've recently changed from a SATA SSD to NVMe SSD for my Windows PC and there's a format option for the NVMe SSD to use 4096 byte sectors for better performance. Changing this erases the contents and I had already copied everything to it so I had to use the SATA SSD as a backup copy. Shrinking the filesystem before starting helps here.

The EFI System Partition (FAT32) must be at least 257MB (65537 * 4096 bytes; normally 260MB) for a disk with 4096 byte sectors. I recreated this and copied the files for it. Windows is unable to modify the older 100MB partition configured for 512 byte sectors, even though it can boot from it. To be able to boot, the disk and partition GUIDs must be preserved when recreating the partitions.

The NTFS boot sector (at the start of the partition) contains references to the sector size of the disk. This is unnecessary information on more modern filesystems but NTFS is 28 years old. Changing the following little-endian values allows Windows to use the filesystem without needing to recreate it (instructions assume a 4K cluster size):

OffsetNameModification
0x0BBytes per sector0x0200 (512) → 0x1000 (4096)
0x0DSectors per cluster0x08 (8 * 512 = 4096) → 0x01 (1 * 4096 = 4096)
0x1CHidden sectorsThe number of sectors preceding the partition
0x28Total sectorsThe partition size in sectors minus 1

Windows doesn't appear to care if the "Hidden sectors" value is completely wrong (because I originally moved them around without updating it) or if the "Total sectors" is slightly larger than the previous size or the partition.

About this Archive

This page is an archive of entries from September 2021 listed from newest to oldest.

March 2021 is the previous archive.

Find recent content on the main index or look in the archives to find all content.

Content authored by myself is just my honest opinion.

  • Linux
  • Get Firefox!
  • Get Thunderbird!