[syslinux] isohybrid and ISO images whose size is not a multiple of 2048 bytes vs. VirtualBox

Thomas Schmitt scdbackup at gmx.net
Wed Feb 18 12:05:26 PST 2015


anonym <anonym at riseup.net> wrote:
> I've actually only seen the problem with my development builds, 
> or which I use a faster but less efficient
> compression for the included squashfs, so the images end up being around
> 1.2GiB in size. I haven't got a good sample size, but I'd say there
> seemed to be a 50% chance of isohybrid making the image size not
> divisible by 2048.

It should rather be 75 % failure. Theoretically ...

Since the size of the 255x63 cylinders is not divisible
by 2048 but only by 512, the resulting image size is
divisible by 2048 only if the number of cylinders is
divisible by 4.

So the failure comes and goes in cylinder size steps.
3 cylinders bad, fourth cylinder good again.
In case of 255x63, the steps are 8,225,280 bytes each.

I am reading in the original bug report

> One can fix the image by running either of the following:
>     * isohybrid $ISO
>     * isohybrid $ISO -h 253 -s 63
>     * isohybrid $ISO -h 255 -s 62

The first one produces a cylinder size divisible by 2048.
The second one obviously was lucky to cause a number of
cylinders that was divisible by 4.
The third one decreased the probability of failure from
75 percent to 50 percent, and was lucky to produce a number
of cylinders which was divisible by 2.

> Thomas Schmitt wrote:
> > I proposed -h 252 -s 63 because it yields the largest
> > possible cylinder size which is divisible by 4 [blocks of 512]

> Excuse my ignorance, but you say "largest possible cylinder size". We
> are not going to fill up to this theoretical maximum (our images are
> currently ~910 MiB for releases, and ~1.2 GiB for development builds) so
> I just want to double-check that what you propose also guarantees
> divisibility by 2048 for images that doesn't fill up to this maximum.

Yes, it guarantees byte size divisibility by 2048.
That's because the ISO gets padded up to a full cylinder
and each cylinder is divisible by 4 blocks = 2048 bytes.

You can take into respect Ady's concerns and use

  -h 128 -s 32

which produces cylinders of 2 MiB size (and a maximum
padding waste of 2 MiB - 2 KiB).
That's enough for ISO images up to 2048 MiB.

Funnily, 4 MiB is not a possible cylinder size.
(One would have to add a factor of 2 to either -h or -s,
 but each of them would overflow. Since 2 is a prime,
 we cannot smear it over both options.)

Have a nice day :)


More information about the Syslinux mailing list