What defines the signature of a bootsector?

0

I've attempted to simplify the question, by getting at the gist of the problem:

What exactly makes the "first sector" of a device the "bootsector?"

  • Is the bootsector a logical sector, a physical sector, or both?
  • If logical sector and physical sector sizes can differ between devices, does this influence the size of the bootsector?

Parts from the old question below: Part I: What are the differences between READING from the bootsector of 512-byte and non-512-byte sector devices?

For the following devices, which sector is considered the "first sector" or "bootsector"? How are the bootsectors identified in 512-byte sector devices and non-512-byte sector devices? What are their signatures?

  • Floppy disk (512-byte sector)
  • Traditional HDD (512-byte sector)
  • CD-ROM (2048-byte sector)
  • DVD-ROM (?-byte sector)
  • BD-ROM (?-byte sector)
  • Flash Memory Device (Are "sectors" even applicable here?)
  • SSDs (Are "sectors" even applicable here?)
  • Advanced format HDD with 512-byte emulation (4096-byte sector)
  • Advanced format HDD without emulation (4096-byte sector)

For CDs, DVDs, and BDs, what is the physical and logical sector size? CDs are 2048-byte sized sectors; I'm not sure about the DVDs and BDs. For CDs you follow the El-Torito standard to reading and writing bootsectors. For DVDs and BDs, I do not know what standard to follow. The El-Torito standard allows you to either emulate 512-byte sectors (like a floppy or HDD) or you can boot at the native size.

Part II: What are the differences between WRITING to the bootsector of 512-byte and non-512-byte sector devices?

  • Specifically, how do you write to the bootsector of the above devices such that you are able to read from them in Part I?
  • I see dd can be used, but I also see one can simply write a simple C program to open() the device, lseek() to a specified byte offset, and write() directly to the first 512 bytes of the device. (i.e. write starting at index 0)
  • For non-512-byte sized devices, and for OSes that are not aware of non-512-byte sized sector devices, is this even possible? Or is this completely irrelevant?
  • Which portions of the physical sector should be written to for devices that support: (1) 512-byte emulation and (2) no emulation?

wazzy

Posted 2013-08-30T23:06:22.023

Reputation: 1

Answers

0

That is a bit too much for one question. It depends on the computer what media it can boot from and what the physical layout/interfaces/addressing it supports for that media.

In general older interfaces and addressing modes are emulated/translated to support newer devices to maintain a large window of compatibility (new drives work in older computers, a new device type works on an existing interface). The actual physical sector size really only matters for performance - aligning data and sizing structures to such boundaries can be faster than not doing so.

One CDROM standard, El Tortio, for example supports putting a floppy disk image on the CD which is then read by a computer's BIOS and emulated as a floppy. This means a bootable floppy disk could be used to bootstrap a bootable CDROM.

Brian

Posted 2013-08-30T23:06:22.023

Reputation: 8 439

To reiterate what you said, physical sector size only matters for performance. (1) Does this mean that physical sector information is abstracted away from the BIOS / OS/ whatever, and that it is only relevant on the physical device itself? And (2), does this mean that the interfaces to the device influence how the logical sector sizes are perceived by the system? (3) Does this mean that it is just the first LOGICAL sector which corresponds to the bootsector? – wazzy – 2013-09-03T22:10:07.170

Typically, who is responsible for the addressing mode emulation / translation? The device? The interface? The OS? The BIOS? – wazzy – 2013-09-03T22:13:46.083

Your over thinking it. Who is responsible depends on what is trying to be compatible with what - a new device supporting an older standard or a newer interface supporting older devices or an older software API. When a mismatch between physical and logical sector sizes would hurt performance there is usually some work around - like aligning partitions to 4k boundaries on Advanced Format drives. – Brian – 2013-09-03T22:29:02.250

My goal is to try to come away with some useful generalizations, so that's why I'm asking a lot of questions for clarification... I still haven't found any references that indicate exactly what makes a bootsector a bootsector on a given device. If you think about it, you can conclude that the bootsector is going to be located in the first "logical sector" of the device, as specified by what the device returns. Of course, maybe that get re-interpreted by the BIOS (reading from device) or the OS (when writing to device). But I have nothing to support or refute that claim. – wazzy – 2013-09-10T22:32:47.813