How to 'fix' disk with 512-byte sectors, formatted using an enclosure that translated to 4k sectors
This is not a direct answer to my question, as it doesn't apply a proper fix to the disk (which is what I am most interested in).
However, from a practical stand-point it solves the problem, in a rather slow and roundabout way.
I have found a free tool called TestDisk by CG Security, which seems to run on pretty much any operating system. The tool can be instructed to read the disk using arbitrary sector sizes, which means we can override the physical sector size reported by the drive and recover the data from it.
How to use
Having downloaded and installed this command-line utility, run it, make a decision about how any log files should be created, and then:
- Select the disk from the list. Make sure you select the physical Disk rather than the logical Drive.
- Select the
Intel
partition type. - Select the
Geometry
option and changeSector Size
from512
to4096
. This will allow TestDisk to read the disk properly. - Select
Advanced
which takes you to the file utilities, and - if there is more than one partition - select the partition you are interested in. You should also at this stage note-down the partition sizes, if you plan to rebuild the disk later. - Select
List
to view the files on the disk. - From here you can browse the file system, select individual files or groups of files, and copy them to another location (i.e. to a different disk).
- To copy the whole disk, from the root directory, select
a
to select all files, then capitalC
to copy the selected files, then browse to the destination disk and press capitalC
again to copy all the files across. - Repeat if there are multiple partitions.
You have now made a backup of the whole disk! You can therefore use the standard operating system tools to wipe and repartition the original disk as per the previous layout (this will automatically use the correct geometry now that there is no disk enclosure translating the sectors) and copy the files back to complete the rebuild.
Note that the above instructions only restore the disk partitions and file structures but this may not be sufficient if you also need boot sectors, use non-NTFS drives, have files that need to be in particular disk locations (rare) or use other more sophisticated gubbins (e.g. alternative data streams). All of these issues may or may not be resolvable using this tool, but not with the above instructions.
(Note that I don't really want to have to accept this as the answer, as it is actually side-stepping my question rather than resolving it. However, I am noting it here as an alternative approach.)