Create another partition on free space of USB after 'dd' installing debian

Basically a duplicate of this question but being more clear and providing more details.

What I want is to have a USB drive with two things: The debian installer, and another partition using the remaining space of the USB. It should not be used for persistance within debian. Just a regular usable partition.

In my linked question fdisk/gparted is recommended, but those don’t really work.

GParted shows this:


sdc              8:32   1   7.5G  0 disk  
├─sdc1           8:33   1   2.7G  0 part  
└─sdc2           8:34   1   2.9M  0 part

fdisk /dev/sdc:

The device contains ‘iso9660’ signature and it will be removed by a
write command. See fdisk(8) man page and –wipe option for more

I tried ignoring this and creating a third partition anyway, it worked but made debian unable to boot. The bootmenu shows up but when trying to boot it gives several errors about not finding an ext3/ext4 partition or something similar. My PC (nautilus file manager) also doesn’t detect the debian partition anymore after the fdisk write with the third partition.

fdisk -l:

Device     Boot Start     End Sectors  Size Id Type
/dev/sdc1  *        0 5706399 5706400  2.7G  0 Empty
/dev/sdc2        1600    7487    5888  2.9M ef EFI (FAT-12/16/32)

dd command used:
dd if=debian.iso of=/dev/sdc bs=1M status=progress

Asked By: confetti


ISO hybrid images are crazy combinations of iso9660 format and multiple partition tables to make sure it boots everywhere. This is how the superblock looks:

DEVICE OFFSET TYPE    UUID                   LABEL
sdb    0x8001 iso9660 2020-09-26-10-19-19-00 Debian 10.6.0 amd64 n
sdb    0x1fe  dos                            
sdb    0x200  gpt                            
sdb    0x0    mac

You can’t remove any of these. If you want to add a new partition, simply tell fdisk to not wipe other signatures on the device and use only the dos partition table using

fdisk --wipe=never -t dos /dev/sdX

and add a new partition. I did a quick test with Debian netinstall ISO and the new partition is usable and the installer still boots.

Answered By: Vojtech Trefny

The fdisk --wipe=never seems to be deprecated now. I’m trying in Debian 11 and it no longer honours the request to not wipe. Debian 10 works just fine (yes, the documentation still shows wipe can be always/never/auto, but it doesn’t seem to actually still work.)

Just me, or has anybody else found this?

root@vostro:~# fdisk --wipe=never -t dos /dev/sdc

Welcome to fdisk (util-linux 2.36.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

The device contains 'iso9660' signature and it may remain on the device. It is recommended to wipe the device with wipefs(8) or fdisk --wipe, in order to avoid possible collisions.

Command (m for help): 
Answered By: David
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.