Cloning CompactFlash Cards using WinHex

2005-02-05 12:16 by Ian

A procedure for making byte-for-byte copies of CF cards. Written while working at a camera repair shop that needed this capability, but it’s also useful for lifting partitions from a development system using a conventional hard drive and dropping them onto a CF card for operation in a finished condition (after appropriate edits).

This was written for people who were already comfortable with technical things, but not necessarily computers.

Procedure for making a 1:1 copy of a CF card in WinHex:

Background:
A sector is a group of (usually) 512 bytes.
The CompactFlash spec includes the ability of any given CF card to be used as an ATA hard drive. This is what a USB card reader does. All sectors of a hard drive MUST be accessible. It follows that NO manufacturer can hide data, and simultaneously conform to the CF spec. So we take advantage of this.


Open WinHex:
The basic idea is to read (verbatim) every sector of the source CF card, and then write the sectors in the same order (and starting at the same point) to the target card.

1. Open WinHex and insert your source CF card into the reader. Find a target card that is close to the same size as your source card. More on this later. If the target card is smaller than the source card, this procedure might work, but for the sake of compatibility, should be avoided.

2. In WinHex, goto “Tools->Disk Editor” (or push F9) and select the drive letter that corresponds to your source card. You will be presented with a frightening field of hexadecimal numbers. These numbers each have an offset value that is located on the far left of the field.

3. The most reliable way to copy all the data sectors is to be SURE you are at offset 00000000, click the first element in the row. Hit ALT+1 to designate it as the start of the data. Next scroll all the way to the end of the data (or to the bottom of the field), double-click the last element, and hit ALT+2 to define the last element.

4. CTRL+C to copy the block. If you wish, at this point, you may goto “Edit->Copy Block->Into new file”. This will allow you to keep a liquid copy of the source data.

5. Eject the source card, and replace it with the target card.

6. Again, BE SURE you are at offset 00000000. The first element in the row. CTRL+V to paste the data.

7. After pasting the data, goto “File->Save Sectors”. After this has finished, the copy process has been completed.


Here is what you have just done as it relates to the computer:
When a computer/camera/whatever is made to access files from
a CF/Hard disk, the media always contains two basic things:

Media descriptors tell the computer what format of media is being used, and where to find the FAT. The FAT is used to locate and provide boundaries for specific chunks of data that usually correspond to files. The key idea here is that the descriptor and the FAT contain ALL of the metadata that is needed to reproduce a data structure. But without modification, there are a few relevant constraints that come with this ability…

Olympus used to use a technique of embedding a series of digits in “less accessible” areas of SmartMedia cards to enable features like panoramic capture. Olympus used this strategy to make people purchase their media cards from them at a premium. The key thing to remember at all times when dealing with data, is that if it was ever accessible, it can be so again. And therefore we can reproduce it with the same types of techniques described above.

Previous:
Next: