The first partition of msdos partition table is defined to start at sector 2.
The partition-table starts the first partition at sector 2.
If a binary is defined inside the partition, then the binary should start from sector 2 onward.
However sector 2-18 will be zeroed. The binary is overwritten / never-written in those sectors, while continuing correctly from sector 19 onward.
If a ext4 partition is defined, the first superblock with 1024 byte offset (start sector 4), is zeroed. And all following sectors till sector 19.
$ fdisk /dev/loop0
Welcome to fdisk (util-linux 2.36.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/loop0: 550 MiB, 576716800 bytes, 1126400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x874709fa
Device Boot Start End Sectors Size Id Type
/dev/loop0p1 2 8193 8192 4M 83 Linux
...
Description
Following xml results in a problem:
Problem
The first partition of msdos partition table is defined to start at sector 2. The partition-table starts the first partition at sector 2.
Test Versions:
XML
Trace Binary
Partition in partition-table
File attached: msdoshd.zip
losetup -P /dev/loop0 <image>
Content of partition
hexdump -Cn 9296 --skip 512 <image>
Trace ext4
msdoshd-ext4.zip
losetup -P /dev/loop0 <image>
hexdump -Cn 2048 /dev/loop0p1
The result should have looked like, if defined outside sectors 2-18: