Hi,

nwe wrote:
> I use xfce4 and thunar file manager, only the iso shows up in thunar when I
> plug in the usb drive. I assume it is because my iso image literally tells
> whatever is in charge of auto-mounting, that the end of the iso is the end
> of the disk.

Possibly it is Thunar's deliberate decision to ignore partitions if
it detects an ISO 9660 filesystem surrounding them. (I.e. the
partition table sits in the System Area of the ISO, which is the
dedicated room of 32 KiB to put arbitrary non-ISO 9660 data.)

The Linux kernel offers ioctl(BLKGETSIZE) to determine the size of a
storage device. This inquires the firmware of the device, not the
content of its storage area.
See for example
  https://www.man7.org/linux/man-pages/man4/sd.4.html
It would be astounding if Thunar would not use that call if it is
interested in knowing the stick's size.


> I dd cloned the iso to /dev/sdf clobbering the partition table I think.

That's what debian-cd and debian-live expect the users to do.


> I started fdisk, telling it to not delete my iso:
> sudo fdisk --wipe=never --wipe-partitions=never /dev/sdf
> then entered like t c w
> finally I formatted the new partition
> sudo mkfs.vfat -F 32 -n RECOVERY /dev/sdf3

No mistake to see here.


nwe wrote:
> > > Device     Boot  Start      End  Sectors  Size Id Type
> > > /dev/sdf1  *        64   524287   524224  256M  0 Empty
> > > /dev/sdf2          540     1819     1280  640K ef EFI (FAT-12/16/32)

I wote:
> > Looks normal, except the fact that partition 2 is inside partition 1.
> > This flaw is inherited from the ISO.

mick.crane wrote:
> Could this indicate that the image was written to a partition /dev/sdf1
> instead of /dev/sdf ?

No. In that case the partition table of the ISO would not be
interpreted by Linux and other readers.

The EFI System Partition 2 of a Debian amd64 ISO is a data file inside
ISO 9660 filesystem. Partition 1 marks the range of the ISO filesystem.
So number 2 has to sit inside number 1. 

That's something which EFI and partition editors hate. As mitigation
the partition layout of Debian ISOs has the type of partition 1 set
to 0, which EFI is specified to ignore. So (other than Thunar)
EFI (and gdisk) recognize only partition 2 and ignore partition 1.
Linux and fdisk recognize both partitions. (xorriso recognizes
everything in the ISO, believes nothing of that, and offers to
do it again. :))


mick.crane wrote:
> > Could this indicate that the image was written to a partition
> > /dev/sdf1 instead of /dev/sdf ? 

nwe:
> According to my notes I did dd it directly to /dev/sdf
>
> I had noticed the EFI partition inside the iso and left it. It booted
> without a problem.

That was the right thing to do for making the own boot equipment of the
ISO visible to EFI.


> My assumption, and possibly flawed logic was that I'm
> writing this 256MB iso blob to the first 256MB of my usb drive, and could
> have potentially used a 256MB usb drive for just that.

Correct.


> Therefore if the iso
> uses EFI, that must/(can?) be included in the iso. Correct me if I am wrong.

The EFI System Partition can sit anywhere on the USB stick.
It just has to be advertised to the EFI firmware by a partition table
entry in either MBR table or GPT. (For booting from CD, DVD, BD it
needs to be advertised by the El Torito catalog, which has no job
on USB stick.)


> Digging into this got me thinking, what if dd writing the iso to sdf1 would
> have made life easier?

You would have deviated from the official way of using a bootable
Debian ISO.
There are third-party ways like with Rufus or Ventoy which avoid
overwriting the whole existing partition table of the stick by the
table(s) of the ISO,


> What I have is working good enough, why spend more time on it.

Only the Thunar riddle remains.


Have a nice day :)

Thomas


Reply via email to