Hi,

> I seem to have another problem now, maybe because I
> previously had an OpenBSD install image on that USB drive and it uses a
> non-standard fdisk partition scheme. I have to go find out now how the disk
> partition tables work on USB drives, ... 

In general it's like with any other kind of hard disk.
The partition table is normal data on the unpartitioned device.

In the case of t2-25.4-x86-64-musl-base-wayland-musl-clang-nocona.iso
the partition table is in a "classical generic MBR" as of
https://en.wikipedia.org/wiki/Master_boot_record .
I.e the table is in bytes 446 to 509 of the first block of the
image and - after copying - of the unpartitioned device.
In Linux this would be e.g. the first block of /dev/sdc.

The table in the T2 ISO defines two partitions /dev/sdc1 and /dev/sdc2
which the operating system offers after studying the MBR table.
/dev/sdc1 exposes the ISO 9660 filesystem.
/dev/sdc2 exposes the EFI System Partition.
To be recognized by operating systems the ISO image with its MBR has to
be copied onto dev/sdc, not to /dev/sdc1 or any other partition device,
in order to let block 0 of the ISO overwrite block 0 of the USB drive.
This way the drive inherits the partitioning of the ISO image.
Linux will recognize the new partitioning after unplugging and
replugging of the USB cable or after a run of hdparm -z /dev/sdc.

If a partition editor insists that the USB drive with this ISO image
has a damaged GPT (GUID Partition Table), then probably because of the
content of the last block of the unpartitioned USB drive device.
Do not accept the offer to repair the GPT but rather get rid of that
remnant GPT backup header block.
Determine its address by e.g.:

  $ lsblk -d -b -o NAME,SIZE /dev/sdc
  NAME         SIZE
  sdc  125829120000
  $ expr 125829120000 / 512 - 1
  245759999
  $

This block address would be the legitimate target of zeroization.
Verify this by:

  $ dd if=/dev/sdc bs=512 skip=245759999 | head -c 8 | od -c
  ...
  0000000   E   F   I       P   A   R   T
  0000010

That string is the magic number of a GPT header block.
To zeroize it, do:

  $ sudo /bin/dd if=/dev/zero of=/dev/sdc bs=512 seek=245759999 count=1

(xorriso-dd-target zeroizes the last block of a USB stick before
putting the image onto it.)

The BSDs usually install their "partitions" in a single partition table
entry which they call "slice". So if the partition table gets
overwritten then the BSD partitioning should be gone too.

In case of doubt, zeroize the whole USB drive before putting the ISO
onto it. No partition table survives being overwritten with zeros,
regardless where on the device it is stored.


Have a nice day :)

Thomas

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
li...@t2-project.org with a subject of: unsubscribe t2

Reply via email to