FAT12 Extended Boot Signature

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
overburn
Member
Member
Posts: 50
Joined: Sun Feb 22, 2009 9:15 am

FAT12 Extended Boot Signature

Post by overburn »

Hey guys,

So , on a fat12 boot record , there is the extended boot signature that as far as I see, can be either 28 or 29 for a fat12 implementation.
But what do those numbers mean? A bit confused, and I can't seem to find an answer.
One Tequila, Two Tequila, Three Tequila, Floor!
User avatar
Bender
Member
Member
Posts: 449
Joined: Wed Aug 21, 2013 3:53 am
Libera.chat IRC: bender|
Location: Asia, Singapore

Re: FAT12 Extended Boot Signature

Post by Bender »

You sure you taklin' 'bout FAT12? :)
FAT16 uses the above BIOS Parameter Block, with some extensions:

11-27 (as before)
28-31 Number of hidden sectors (0)
32-35 Total number of sectors in the filesystem
(in case the total was not given in bytes 19-20)
36 Logical Drive Number (for use with INT 13, e.g. 0 or 0x80)
37 Reserved (Earlier: Current Head, the track containing the Boot Record)
Used by Windows NT: bit 0: need disk check; bit 1: need surface scan
38 Extended signature (0x29)
Indicates that the three following fields are present.
Windows NT recognizes either 0x28 or 0x29.

39-42 Serial number of partition
43-53 Volume label or "NO NAME "
54-61 Filesystem type (E.g. "FAT12 ", "FAT16 ", "FAT ", or all zero.)
62-509 Bootstrap
510-511 Signature 55 aa
Here's a FAT12 Version from the same source:
Bytes Content
0-2 Jump to bootstrap (E.g. eb 3c 90; on i86: JMP 003E NOP.
One finds either eb xx 90, or e9 xx xx.
The position of the bootstrap varies.)
3-10 OEM name/version (E.g. "IBM 3.3", "IBM 20.0", "MSDOS5.0", "MSWIN4.0".
Various format utilities leave their own name, like "CH-FOR18".
Sometimes just garbage. Microsoft recommends "MSWIN4.1".)
/* BIOS Parameter Block starts here */
11-12 Number of bytes per sector (512)
Must be one of 512, 1024, 2048, 4096.
13 Number of sectors per cluster (1)
Must be one of 1, 2, 4, 8, 16, 32, 64, 128.
A cluster should have at most 32768 bytes. In rare cases 65536 is OK.
14-15 Number of reserved sectors (1)
FAT12 and FAT16 use 1. FAT32 uses 32.
16 Number of FAT copies (2)
17-18 Number of root directory entries (224)
0 for FAT32. 512 is recommended for FAT16.
19-20 Total number of sectors in the filesystem (2880)
(in case the partition is not FAT32 and smaller than 32 MB)
21 Media descriptor type (f0: 1.4 MB floppy, f8: hard disk; see below)
22-23 Number of sectors per FAT (9)
0 for FAT32.
24-25 Number of sectors per track (12)
26-27 Number of heads (2, for a double-sided diskette)
28-29 Number of hidden sectors (0)
Hidden sectors are sectors preceding the partition.
/* BIOS Parameter Block ends here */
30-509 Bootstrap
510-511 Signature 55 aa
Source: http://www.win.tue.nl/~aeb/linux/fs/fat/fat-1.html
"In a time of universal deceit - telling the truth is a revolutionary act." -- George Orwell
(R3X Runtime VM)(CHIP8 Interpreter OS)
User avatar
iansjack
Member
Member
Posts: 4711
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: FAT12 Extended Boot Signature

Post by iansjack »

54-61 Filesystem type (E.g. "FAT12 ", "FAT16 ", "FAT ", or all zero.)
I wonder why the BIOS Parameter Block allows for FAT12 if it is not used in a FAT12 disk?
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: FAT12 Extended Boot Signature

Post by Brendan »

Hi,
iansjack wrote:
54-61 Filesystem type (E.g. "FAT12 ", "FAT16 ", "FAT ", or all zero.)
I wonder why the BIOS Parameter Block allows for FAT12 if it is not used in a FAT12 disk?
The wikipedia page is probably a better reference.

As far as I know; there are about 7 different versions of the BPB (used by different versions of DOS and Windows), any of them can be used with any file system, and there's no sane way to determine which one a file system actually used.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
qw
Member
Member
Posts: 792
Joined: Mon Jan 26, 2009 2:48 am

Re: FAT12 Extended Boot Signature

Post by qw »

The [url=http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/fatgen103.doc]Microsoft Extensible Firmware Initiative FAT32 File System Specification[/url] wrote:Extended boot signature (0x29). This is a signature byte that indicates that the following three fields in the boot sector are present.
The three fields are: the volume serial number, the volume label, and a string that names the file system type. The latter could be anything and should not be relied upon to determine the actual file system type.

So if the extended boot signature is not 0x29, these fields are not present.
tom9876543
Member
Member
Posts: 170
Joined: Wed Jul 18, 2007 5:51 am

Re: FAT12 Extended Boot Signature

Post by tom9876543 »

The BIOS Parameter Block is another example of pathetic design from Microsoft.
Even in the world of 8086s with 128KB RAM and pathetic floppy drives that can't autodetect disk geometry, the BPB could have had a much better design.
Here is an example of what Microsoft should have done.

Code: Select all

Sector Offset     Size  Description
-----------------------------------
0x08               3    Signature "BPB", and do not assume next byte is zero
0x0B               1    Reserved (set to zero)
0x0C               2    Sector Size
0x0E               2    Total logical sector count
0x10               2    INT13h Sectors Per Track
0x12               2    INT13h Number Of Heads
0x14               4    Volume Serial Number
0x18              16    Volume Label (null terminated C string)
0x28               8    File system type (null terminated C string e.g. "FAT12")
0x30               2    Checksum of BPB - Sector bytes 0x08 - 0x31

The other bytes in the boot sector are reserved for boot code or filesystem specific information.

User avatar
iansjack
Member
Member
Posts: 4711
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: FAT12 Extended Boot Signature

Post by iansjack »

I'm not convinced that a maximum of 65,356 sectors on the disk is an improvement on what Microsoft came up with. Especially nowadays when we are aware of just how big disks can get.
Antti
Member
Member
Posts: 923
Joined: Thu Jul 05, 2012 5:12 am
Location: Finland

Re: FAT12 Extended Boot Signature

Post by Antti »

tom9876543 wrote:the BPB could have had a much better design
It is hard to disagree because almost everything can be improved. Before blaming Microsoft, it would be reasonable to suggest an improved example that provides at least the same functionality as the original one.
tom9876543 wrote:Here is an example of what Microsoft should have done.
There are a lot of things that I could complain about this example. It is hard to believe that your example is a much better design. Yes, the original design might be "pathetic" but I do not believe that something like "Here is an example of what Microsoft should have done" is an easy thing to do. I would not even suggest anything without first doing a lot of research.
tom9876543
Member
Member
Posts: 170
Joined: Wed Jul 18, 2007 5:51 am

Re: FAT12 Extended Boot Signature

Post by tom9876543 »

1)
I believe disk drives in 1980 had no way of autodetecting the disk sector size, number of cylinder, number of heads etc.
The BPB should have been specifically built to solve this problem ONLY.
As all file systems have a "serial number" and "label", adding in those values to the BPB is not a bad idea.
However, "RootDirEntries" is a file system (FAT) specific concept. It should never have been put in the BPB.

2)
The design I created was based on the assumption it was being designed in the year 1980.
So in 1980 2 bytes for total sectors was acceptable.
I wouldn't expect Microsoft in 1980 to predict gigabyte usb drives.
Last edited by tom9876543 on Fri Apr 04, 2014 2:51 pm, edited 4 times in total.
User avatar
iansjack
Member
Member
Posts: 4711
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: FAT12 Extended Boot Signature

Post by iansjack »

Well, I would say that Microsoft in 1980 - without the benefit of hindsight - did a better job than you by introducing the concept of clusters rather than just sectors. Thus they allowed for disks larger than 32 MB; even in 1980 this was not that outlandish a concept.

Btw, a basic unit of disk space larger than the native sector is not unique to FAT filesystems.
tom9876543
Member
Member
Posts: 170
Joined: Wed Jul 18, 2007 5:51 am

Re: FAT12 Extended Boot Signature

Post by tom9876543 »

OK its fair to say "Sectors Per Cluster" should also be in the BPB.
Post Reply