cwindowsdiskmbr

How is MBR stored if the sector size is bigger than 512 bytes?


So as far as i know, MBR size is 512 bytes and it ends with 0x55AA.

My questions are :

  1. How common is it for disks to have a sector size bigger than 512 bytes ? (eg disks used in servers, etc)

  2. How will MBR get stored if sector size is for example 4096? is the 4095th byte equal to 0x55 or the 511th byte?

  3. Do i need to check for sector size before reading MBR in my C code? is this something i need to worry about, or just reading 512 first bytes of a disk is enough ?


Solution

  • Most of the devices even if the underlying hardware uses longer blocks provide "standard" interface where block size 512 bytes.

    If the size of the sector is larger than 512 bytes the MBR will look exactly the same bytes. All data will be at the same offsets. Simply the remaining part of the sector will not be used.

    If the sector size is smaller then 512 bytes then MBR will occupy more than one sector.

    Do i need to check for sector size before reading MBR in my C code?

    Very often the single sector is minimum chunk you need to read, so it is good to know its size as you need to allocate a buffer to store this data.