Does diffoscope compares disk partitions
Thomas Schmitt
scdbackup at gmx.net
Wed Mar 1 20:44:56 UTC 2023
Hi,
Mattia Rizzolo wrote:
> So, overall, I actually don't think that diffoscope has the requested
> support, and it's not "just" a bug of failed identification.
If it gets support for detecting partitions in image files then it will
have to handle hybrid bootable ISO 9660 images which bear partition
tables for the case that they get copied onto a USB stick.
There are various layouts. Some are quite awkward and invite for getting
lost in the woods. (Actually they lure firmwares out of the woods.)
E.g. debian-11.5.0-amd64-netinst.iso has two partitions in the MBR table
plus a GPT header which most readers won't take into respect but will
appease older versions of OVMF virtual EFI. MBR partition 1 marks the
whole ISO 9660 filesystem. MBR partition 2 marks a data file range within
that ISO filesystem (i.e. abominable partition nesting). The data file is
actually a FAT filesystem image, which could possibly begin by an MBR
with partition table. Further there is an Apple Partition Map with ai
single partition marking the FAT filesystem image for EFI.
This partition layout is an invention of Matthew J. Garrett for Fedora.
ubuntu-22.04-desktop-amd64.iso has a nearly properly announced GPT with
the tiny flaw of an MBR partition 2 of type 0x00 which carries the
"bootable" flag. That's a lure for some legacy BIOS laptops which don't
consider a disk for booting if it does not have a partition with the flag.
The 3 not nested GPT partitions mark the ISO filesystem, the EFI partion,
and the traditional 300 KiB of padding. The EFI partition is not a data
file in the ISO filesystem.
The confusion is completed by the fact that the overall image is a
mountable ISO filesystem which claims the whole size of the image file
including the EFI partition and the padding. Nevertheless GPT partition 1
does not start at the start of the image file but is an ISO filesystem too,
which bears the same files as the overall ISO fileystem.
grub-mkrescue produces for x86_64 a boringly specs compliant ISO with GPT
at the cost that there is no mountable ISO partition in the GPT. But the
image also contains an Apple Partition Map with a partition pointing to
a HFS+ filesystem which shows the same files as the ISO 9660 filesystem.
(It is of course possible to mount the overall image file as ISO 9660.)
Quite like a normal disk image is Fedora-Everything-netinst-x86_64-37-1.7.iso
with its 3 GPT partitions. The only unusual aspect is the mountability of
the overall image file with an ISO filesystem which claims the block range
of all three partitions.
All these images contain block ranges which are neither covered by the
ISO 9660 file tree nor by the partitions.
One will always first have to compare such ISOs byte-by-byte and only in
case of mismatch look into the ISO filesystem and partitions for a more
qualified presentation of the differences.
Have a nice day :)
Thomas
More information about the rb-general
mailing list