On May 19, 3:06 pm, "Mike Gonta" <
mikego...@gmail.com> wrote:
...
> THIS SHOULD BE:
>
> First, format the media in the desired format.
> Then, using any of the 4 images (which can be used with any of the
> formats) transfer (using a disk editor or DD) the first sector
> of the image beginning at offset 0x5A of the image to the same offset
> (0x5A) of the media.
And bytes 0 to 2?
> Then transfer the 3rd and 4th sectors (skipping the second sector) to
> the 3rd and 4th sectors of the media. (Skipping the second sector LBA 1
> is only required for FAT32 to maintain the the formatted File System
> Information sector - which by default is loacted here).
Unless extra sectors have been reserved (BPB field at offset 14,
BPB_RsvdSecCnt) wouldn't the third and fourth sectors hold part of the
first FAT?
AIUI a FAT volume is formatted as these regions, in order,
1. Reserved space including the boot record
2. FATs (usually two of them)
3. Root directory (fat12 and fat16 only)
4. Data area
If the medium has the default of only one sector reserved then the
FATs would immediately follow, AIUI.
As an aside, to reserve the space your code needs it might be feasible
to increase the reserved sector count on an *existing* volume, i.e.
not have to reformat it first. Any files at the start of the data
section of a Fat disk could be relocated quickly enough as long as
they were not marked as system files. Then the FATs could be shifted
up into that space. The FAT entries would need to be renumbered so
they related to the new positions but that might not be too difficult.
It might even be possible to relocate system files as long as the
renumbering took care to keep all their cluster numbers the same as
they were at the start.
A fair bit of work, though. Code to do that would be fairly long and a
lot would depend on it being absolutely right! On the other hand there
may be some utility out there which will do this already.
James