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
ddcan be used, but I also see one can simply write a simple C program to
lseek()to a specified byte offset, and
write()directly to the first 512 bytes of the device. (i.e. write starting at index
- 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?