On Wed 07 Oct 2026 at 13:54:16 (-0400), Stefan Monnier wrote:
> > I noted in an earlier post today, I did get it working on one of my usb
> > drives, but it seems sort of a hacky configuration.
> 
> Part of the issue is that the ISO images have historically been created
> with a lot of care to make them bootable in a wide variety of contexts.

Agreed. And it's not clear to me whether this ability is a requirement
of the OP, as they don't say what they want their USB to do, just that
they want to tweak a couple of files involved in booting.

> Maybe nowadays things are simpler, but in the past, booting from a CDROM
> or a floppy worked a bit differently than booting from an HDD, and then
> things got worse with the introduction of GPT partitions and the UEFI
> boot protocol, so you had different ways to boot from an HDD with
> different tools handling the different options differently (e.g. some
> reading only the GPT, other reading only the MBR partition table,
> others reading both with different preferences), so it sometimes
> required a lot of care to make sure that your Linux kernel, your boot
> loader, and your BIOS all agreed about what is where.
> 
> E.g. not sure if current ISOs have both a GPT and an MBR partition
> table, but if that's the case, you may have to change both consistently
> if you want to add a partition.

I wouldn't know how to do this. My understanding is that there are
some Debian experts who know how to mangle the USB appropriately.
Understandably, the normal tools refuse to perform such delinquent
behaviour, as it's like to lead to loss of data in the general case.

FYI here's what I observed on the Debian 12.9 netinst:

# gdisk -l /dev/sdb
GPT fdisk (gdisk) version 1.0.6

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: present

Found valid MBR and GPT. Which do you want to use?
 1 - MBR
 2 - GPT
 3 - Create blank GPT

Your answer: 1
Disk /dev/sdb: 7825408 sectors, 3.7 GiB
Model: USB DISK        
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 0DC5ADF0-2D26-49C0-9280-6D207B4602A4
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 7825374
Partitions will be aligned on 4-sector boundaries
Total free space is 7806301 sectors (3.7 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   2            4524   

# gdisk -l /dev/sdb
GPT fdisk (gdisk) version 1.0.6

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: present

Found valid MBR and GPT. Which do you want to use?
 1 - MBR
 2 - GPT
 3 - Create blank GPT

Your answer: 2
Using GPT and creating fresh protective MBR.
Warning! Main partition table overlaps the first partition by 64 blocks!
You will need to delete this partition or resize it in another utility.
Disk /dev/sdb: 7825408 sectors, 3.7 GiB
Model: USB DISK        
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): D5680A90-A675-40F1-9746-D1817EEF0B87
Partition table holds up to 208 entries
Main partition table begins at sector 12 and ends at sector 63
First usable sector is 64, last usable sector is 1294282
Partitions will be aligned on 4-sector boundaries
Total free space is 3 sectors (1.5 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   2            4524           23563   9.3 MiB     0700  ISOHybrid1

# fdisk -l -o Device,Boot,Start,End,Sectors,Size,Id,Attrs,Type /dev/sdb
Disk /dev/sdb: 3.73 GiB, 4006608896 bytes, 7825408 sectors
Disk model: USB DISK        
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x28ebc189

Device     Boot Start     End Sectors  Size Id Attrs Type
/dev/sdb1  *        0 1294335 1294336  632M  0    80 Empty
/dev/sdb2        4524   23563   19040  9.3M ef       EFI (FAT-12/16/32)

# 

As an aside, one used to be able to buy USB sticks that had a "CD" at
the start of the drive, followed by a partition of choice. One could
set the boundary between the two parts for different sizes. I have
one where I've set the CD size to zero. Because of the extra
complication, I avoid using it in consumer devices like the car.
It's branded   SanDisk U3 SMART cruzer 4GB. I don't know whether
they're still available on, say, ebay.

Cheers,
David.

Reply via email to