From: "Thomas Schmitt" <scdbackup@gmx.net>
To: bug-xorriso@gnu.org
Cc: guix-devel@gnu.org
Subject: Re: ISO installer image: GPT versus MBR partitions
Date: Wed, 24 Apr 2019 12:34:16 +0200 [thread overview]
Message-ID: <6546677712020146532@scdbackup.webframe.org> (raw)
In-Reply-To: <20190424091323.uyuxd3ib7zfw2cut@pelzflorian.localdomain>
Hi,
Florian Pelz wrote:
> Sorry, I meant to quote this aspect:
I wrote:
> > > One can read trailing garbage not only from USB sticks but also from
> > > most DVD types.
Florian Pelz wrote:
> > So… GPT is wrong for some optical media too?
I wrote:
> Not in this aspect. GPT partitions must not start at block 0.
> So the overall ISO superblock is not mountable as partition and thus
> free to claim the full image size as filesystem size.
I already understood you correctly ... i think. :))
GPT partitioned ISO are not hampered from telling the full image
size as size of the ISO 9660 filesystem.
$ /sbin/gdisk -l guixsd-install-0.15.0.i686-linux.iso
...
Number Start (sector) End (sector) Size Code Name
1 64 34107 16.6 MiB 0700 Gap0
2 34108 39867 2.8 MiB EF00 EFI boot partition
3 39868 1815727 867.1 MiB AF00 HFSPLUS
4 1815728 1816327 300.0 KiB 0700 Gap1
$ expr $(/sbin/isosize guixsd-install-0.15.0.i686-linux.iso) / 512
1816376
The isosize is a bit larger than the end of partition 4, because after
this partition comes the GPT backup.
The isosize matches the image file size:
$ expr $(ls -l guixsd-install-0.15.0.i686-linux.iso | awk '{print $5}') / 512
1816376
But an MBR partition which begins by block 0 and is mountable as ISO 9660
filesystem keeps its ISO superblock from telling a size larger than the
partition. So it cannot claim an appended partition 2 as part of its range.
$ export MKRESCUE_SED_MODE=mbr_hfs
$ grub-mkrescue --xorriso=./grub-mkrescue-sed.sh -o output.iso minimal \
--iso_mbr_part_type 0x83
...
$ /sbin/fdisk -l output.iso
...
Disklabel type: dos
...
Device Boot Start End Sectors Size Id Type
output.iso1 * 0 28371 28372 13.9M 83 Linux
output.iso2 28372 34131 5760 2.8M ef EFI (FAT-12/16/32)
$ expr $(/sbin/isosize output.iso) / 512
28372
This discrepancy of image file size and isosize is undesirable when the
image file itself cannot say its size any more, because it is on USB
stick or a DVD which delivers more bytes than were written as image.
So i propose partition offset 16 to get the partition superblock away
from being mountable by the base device.
$ export MKRESCUE_SED_MODE=mbr_hfs
$ grub-mkrescue --xorriso=./grub-mkrescue-sed.sh -o output.iso minimal \
-partition_offset 16 --iso_mbr_part_type 0x83
This yields
$ /sbin/fdisk -l output.iso
...
Disklabel type: dos
...
Device Boot Start End Sectors Size Id Type
output.iso1 * 64 28695 28632 14M 83 Linux
output.iso2 28696 34455 5760 2.8M ef EFI (FAT-12/16/32)
The ISO filesystem of the overall image then claims the image file size
$ expr $(/sbin/isosize output.iso) / 512
34456
With the partition's ISO filesystem we only get the partition size:
$ dd if=output.iso bs=512 skip=64 of=partition1.iso
$ expr $(/sbin/isosize partition1.iso) / 512
28632
This is how it should be.
The ISOs of Fedora, Debian, Ubuntu, and others are MBR partitioned and
most of them have no partition offset 16. But despite that fact they can
claim the full image size as ISO 9660 filesystem size.
This is possible because partition 1 covers the whole image and partition 2
is located inside partition 1. Strictly illegal in UEFI specs, unless
the outer partition has MBR partition type 0x00 and thus does not exist
for EFI and some partition editors. (I.e. this is a really dirty hack.)
$ /sbin/fdisk -l debian-live-9.8.0-amd64-xfce.iso
...
Disklabel type: dos
...
Device Boot Start End Sectors Size Id Type
debian-live-9.8.0-amd64-xfce.iso1 * 0 3811391 3811392 1.8G 0 Empty
debian-live-9.8.0-amd64-xfce.iso2 1432 2263 832 416K ef EFI (FAT-1
$ expr $(/sbin/isosize debian-live-9.8.0-amd64-xfce.iso) / 512
3811392
Old /sbin/gdisk only reports partition 2:
$ /sbin/gdisk -l debian-live-9.8.0-amd64-xfce.iso
...
Found valid MBR and GPT. Which do you want to use?
...
Your answer: 1
...
Number Start (sector) End (sector) Size Code Name
2 1432 2263 416.0 KiB EF00 EFI System
Have a nice day :)
Thomas
next prev parent reply other threads:[~2019-04-24 10:33 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190415165451.dpzngealeisbibc7@pelzflorian.localdomain>
[not found] ` <1582867226375139246@scdbackup.webframe.org>
2019-04-16 9:57 ` bug#33639: ISO installer image is broken on i686 Gábor Boskovits
2019-04-16 13:40 ` ISO installer image: GPT versus MBR partitions (was bug#33639) Thomas Schmitt
2019-04-16 16:32 ` pelzflorian (Florian Pelz)
2019-04-16 17:57 ` ISO installer image: GPT versus MBR partitions Thomas Schmitt
2019-04-16 19:55 ` pelzflorian (Florian Pelz)
2019-04-16 20:31 ` pelzflorian (Florian Pelz)
2019-04-16 21:15 ` Thomas Schmitt
2019-04-17 8:59 ` pelzflorian (Florian Pelz)
2019-04-17 10:23 ` Thomas Schmitt
2019-04-17 10:30 ` pelzflorian (Florian Pelz)
2019-04-17 15:51 ` Thomas Schmitt
2019-04-17 22:35 ` pelzflorian (Florian Pelz)
2019-04-18 6:32 ` Thomas Schmitt
2019-04-18 7:00 ` Thomas Schmitt
2019-04-18 7:07 ` pelzflorian (Florian Pelz)
2019-04-18 8:13 ` Thomas Schmitt
2019-04-18 12:19 ` pelzflorian (Florian Pelz)
2019-04-18 13:50 ` Thomas Schmitt
2019-04-18 21:28 ` Thomas Schmitt
2019-04-19 7:29 ` pelzflorian (Florian Pelz)
2019-04-19 8:03 ` pelzflorian (Florian Pelz)
2019-04-19 9:01 ` Thomas Schmitt
2019-04-19 9:39 ` pelzflorian (Florian Pelz)
2019-04-19 10:58 ` Thomas Schmitt
2019-04-19 14:57 ` pelzflorian (Florian Pelz)
2019-04-19 11:30 ` pelzflorian (Florian Pelz)
2019-04-19 18:33 ` pelzflorian (Florian Pelz)
2019-04-19 19:23 ` Thomas Schmitt
2019-04-20 10:26 ` pelzflorian (Florian Pelz)
2019-04-20 10:50 ` Thomas Schmitt
2019-04-20 11:16 ` Thomas Schmitt
2019-04-20 11:29 ` Thomas Schmitt
2019-04-20 14:23 ` Thomas Schmitt
2019-04-20 14:54 ` pelzflorian (Florian Pelz)
2019-04-20 15:17 ` pelzflorian (Florian Pelz)
2019-04-20 15:33 ` pelzflorian (Florian Pelz)
2019-04-20 16:32 ` Thomas Schmitt
2019-04-21 7:58 ` pelzflorian (Florian Pelz)
2019-04-21 9:35 ` Thomas Schmitt
2019-04-21 11:10 ` pelzflorian (Florian Pelz)
2019-04-21 11:16 ` Thomas Schmitt
2019-04-21 11:56 ` pelzflorian (Florian Pelz)
2019-04-21 12:27 ` Thomas Schmitt
2019-04-21 14:11 ` pelzflorian (Florian Pelz)
2019-04-21 14:36 ` Thomas Schmitt
2019-04-22 13:11 ` Thomas Schmitt
2019-04-23 16:40 ` pelzflorian (Florian Pelz)
2019-04-23 17:23 ` Thomas Schmitt
2019-04-17 12:24 ` Ludovic Courtès
2019-04-17 13:42 ` pelzflorian (Florian Pelz)
2019-04-23 18:14 ` Thomas Schmitt
2019-04-23 19:50 ` pelzflorian (Florian Pelz)
2019-04-23 20:18 ` Thomas Schmitt
2019-04-23 21:43 ` pelzflorian (Florian Pelz)
2019-04-24 6:56 ` Thomas Schmitt
2019-04-24 9:13 ` pelzflorian (Florian Pelz)
2019-04-24 10:34 ` Thomas Schmitt [this message]
2019-04-24 22:13 ` Danny Milosavljevic
2019-04-25 7:07 ` Thomas Schmitt
2019-04-25 9:45 ` pelzflorian (Florian Pelz)
2019-04-25 13:44 ` Thomas Schmitt
2019-04-25 14:59 ` Danny Milosavljevic
2019-04-25 16:22 ` Thomas Schmitt
2019-04-25 17:55 ` Danny Milosavljevic
2019-04-25 18:46 ` Thomas Schmitt
2019-04-25 19:01 ` Danny Milosavljevic
2019-04-25 16:34 ` Ludovic Courtès
2019-04-26 11:34 ` pelzflorian (Florian Pelz)
2019-04-26 14:41 ` Ludovic Courtès
2019-04-26 15:30 ` pelzflorian (Florian Pelz)
2019-04-26 13:57 ` Thomas Schmitt
2019-04-27 13:20 ` Ludovic Courtès
2019-04-27 16:24 ` Thomas Schmitt
2019-04-28 12:53 ` Ludovic Courtès
2019-04-25 11:49 ` pelzflorian (Florian Pelz)
2019-04-25 15:09 ` Thomas Schmitt
2019-04-25 15:58 ` pelzflorian (Florian Pelz)
2019-04-25 16:40 ` Thomas Schmitt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6546677712020146532@scdbackup.webframe.org \
--to=scdbackup@gmx.net \
--cc=bug-xorriso@gnu.org \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).