From: Maxim S. Shatskih on 12 Jan 2006 11:37 > Sometimes removeable media come with the MBR / partition table and so > formatting will retain will retain the MBR. However if the disk is > subsequently damaged then windows will totally reformat the disk, with no > MBR and the dos boot sector as sector 0. It is worthwhile checking for both Exactly. Saw this personally on Iomega ZipDrive. -- Maxim Shatskih, Windows DDK MVP StorageCraft Corporation maxim(a)storagecraft.com http://www.storagecraft.com
From: Maxim S. Shatskih on 12 Jan 2006 11:41 > 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, 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 S=63 and H=255, 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 S=63 and H=255. -- Maxim Shatskih, Windows DDK MVP StorageCraft Corporation maxim(a)storagecraft.com http://www.storagecraft.com
From: psommerfeld on 12 Jan 2006 11:40 larwe wrote: > > It's the one where the 1st byte is EB and offset 3 in the sector has > > the string "MSDOS5.0" on my FAT32-formatted card. I apolozige for not > > knowing the correct term, but it must be the DOS boot sector? > > That's the LBR. Removable flash media are formatted as hard disks. They > have an MBR (partition table) at sector 0. If you formatted the card on > Windows the MBR is probably set up so that the first partition is at > cylinder 0 head 1 sector 1 (i.e. you lose the first track on the disk). > > Look at my DOSFS code for information on the MBR format and C code to > work out the start of the partition. http://www.zws.com/products/dosfs/ Ok, so does it make sense that the MBR, (ie. everything leading up to the LBR), is all 0's on my SD cards? The were formatted as FAT32 under Win XP. Shouldn't the MBR contain some non-0 data? -- Pete
From: larwe on 12 Jan 2006 11:48 > Ok, so does it make sense that the MBR, (ie. everything leading up to > the LBR), is all 0's on my SD cards? The were formatted as FAT32 under > Win XP. Shouldn't the MBR contain some non-0 data? It doesn't match with what I tried when I tested it (see rest of this thread) but others report the same behavior you mentioned. What I got was a populated partition table with an AA55 boot signature at the end (in the first sector). Oh! One thing I forgot - Some USB card-reader devices don't give you physical sector access to the disk; they appear, for want of a better phrase, on int 24h/int 25h only - not on int 13h. On these devices, you can't get at the MBR - all you see is the logical volume. I don't know if they still make readers with this oddity.
From: larwe on 12 Jan 2006 11:55
Maxim S. Shatskih wrote: > First - CHS geometry on a flash card if a fake. > > Second - CHS geometry on post-1995 hard disks is a fake too. This is true, but the reported numbers exist anyway and are visible at the int 13h level if nowhere else. > Third - in Windows, if the disk is not registered in BIOS, then Windows assumes > S=63 and H=255, with a cylinder of 8MB. This is hard-coded to Windows Disk.sys 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. |