The first sector of a disk can contain a MBR (partition table) or a VBR (FAT header).
The MBR in first sector is common for harddisks and SD cards.
The VBR iin first sector s common for floppy disks, but it does reportedly also exist on some SD cards.
Does somebody know a good/tested/reliable/working method for detecting wheter the disk starts with MBR or VBR?
They are unfortunately both using the same ID bytes (55h,AAh in last two bytes), so that isn't helpful. I could only think of using heuristic guessing, like checking that the MBR has partition start smaller than partition end, and checking that (common) VBRs have 2^n bytes per sector, usually 2 fat copies, usually type F8h, commonly ascii characters in volume label, and so on. The probability guessing should work even with some small errors, but might fail when relying or some incorrect "must be always this value" assumptions.
Anyways, there must be several operating systems and other programs already having solved that issue... if there is something that is not too complicated and more or less well tested then I could just use the same method.
The MBR in first sector is common for harddisks and SD cards.
The VBR iin first sector s common for floppy disks, but it does reportedly also exist on some SD cards.
Does somebody know a good/tested/reliable/working method for detecting wheter the disk starts with MBR or VBR?
They are unfortunately both using the same ID bytes (55h,AAh in last two bytes), so that isn't helpful. I could only think of using heuristic guessing, like checking that the MBR has partition start smaller than partition end, and checking that (common) VBRs have 2^n bytes per sector, usually 2 fat copies, usually type F8h, commonly ascii characters in volume label, and so on. The probability guessing should work even with some small errors, but might fail when relying or some incorrect "must be always this value" assumptions.
Anyways, there must be several operating systems and other programs already having solved that issue... if there is something that is not too complicated and more or less well tested then I could just use the same method.