SD Card - boot sector - Page 2

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Re: SD Card - boot sector

Quoted text here. Click to load it

That's an amazingly broad generalization, broad to the point of being
dangerously wrong. It depends entirely on the size of the card -
because it's determined by the reported CHS geometry of the card,
presumably for legacy FDISK reasons. The LBR is generally _one track_
away from the MBR.

For the specific sizes of SD card you've used in recent times, maybe
spt was always 63.

The OP's post clearly shows that your generalization isn't even true
for the cards he happens to have lying about.


Re: SD Card - boot sector
Quoted text here. Click to load it

First - CHS geometry on a flash card if a fake.

Second - CHS geometry on post-1995 hard disks is a fake too.

Third - in Windows, if the disk is not registered in BIOS, then Windows assumes
S63% and H25%5, with a cylinder of 8MB. This is hard-coded to Windows Disk.sys
driver.

Fourth - if the hard disk is registered in BIOS as LBA, then again S63% and
H25%5.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
We've slightly trimmed the long signature. Click to see the full one.
Re: SD Card - boot sector


Quoted text here. Click to load it

This is true, but the reported numbers exist anyway and are visible at
the int 13h level if nowhere else.

Quoted text here. Click to load it

I presume that some USB devices support int 13h type access emulation
then. Also note that PCMCIA adapters (all that I have tested, anyway)
appear at the int 13h level. While I was developing my first DOS
filesystem many moons ago for digital picture frames, I had to use
PCMCIA adapters to check my work, because the USB adapters only gave me
int 25/26h level access.

I repeat: 63 sectors is a generalization and given that we are messing
with data storage devices, a dangerous one. Please don't let your
63-sector-track assumption stomp on my storage media - let me know what
embedded devices you are involved with building, so I can avoid them.

Are you telling me that if I have two partitions on a CF card, and I
accidentally damage the logical structure of the first one, Windows
will silently blow away the second partition if I reformat the card?
Marvelous.


Re: SD Card - boot sector
Quoted text here. Click to load it

Windows cannot support more then 1 partition on removable media.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
We've slightly trimmed the long signature. Click to see the full one.
Re: SD Card - boot sector
Quoted text here. Click to load it

I'm speaking about what Windows uses. If the disk is not in BIOS - then yes,
H25%5 S63%.

Anyway CHS are obsolete, and I think that all modern OSes will work fine the
the MBR disk where the next partition starts at physical sector 1 (not skipping
a track).

More so. Linux runs fine with complete junk in CHS values in MBR entries.

All IO requests to disk are long ago going using LBA, both int 13h and native
(using the OS's driver).

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
We've slightly trimmed the long signature. Click to see the full one.
Re: SD Card - boot sector
Ok, so if the MBR is effectively obsolete on removable media under
Windows, which explains my findings, what is the best method for
determining the equivalent 'CHS' and partition information from the USB
disk?

Thanks,
Alex


Re: SD Card - boot sector
    Once more - in Windows, if the disk is not registered in BIOS, then H63%
and S25%5.
    Also, if the disk is registered in BIOS as LBA, then once again - H63% and
S25%5 by definition.

    CHS values are no more used for IO since around 2000, neither in Windows
nor in Linux. Their only use is to fill the obsolete MBR values. BTW, Linux
boots and works fine with nonsense CHS values in the MBR :-) it was Linux
kernel 2.2.

    Why do you ever need CHS? It is absolutely sure that, for a flash drive,
they are fake, used only to satisfy MS-DOS. All real IO is done using LBA.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
We've slightly trimmed the long signature. Click to see the full one.
Re: SD Card - boot sector
Thanks for the clarification.  I think I jumped the gun and didn't ask
the proper questions to resolve the problem.

- Assuming H63% and S25%5, will the calulated disk size always be
correct when using the cylinder count found with
IOCTL_DISK_GET_DRIVE_GEOMETRY?

- Can a RemovableMedia hold multiple partitions?  If there is no MBR,
yet it works fine in both Linux and Windows machines I'm not sure how
this would be handled?

- Is it possible for a RemovableMedia device (or partition) to be set
active (bootable) like a fixed disk?

- Without an MBR, what is the proper method for reading the partition
information from the disk (eg, type, size, sectors, etc)?

Thanks,
Alex


Site Timeline