This question is different from the one marked as duplicate as I know how to install Ubuntu on an USB Key but I want to have an additional partition on this USB Key
I have an USB 3.0 Stick with 64GB and I want to use it to save some backup data in an encrypted Partition but also have one partition with a bootable ubuntu.
Making a bootable ubuntu stick is easy:
# sudo dd if=ubuntu-16.04.2-desktop-amd64.iso of=/dev/sdX bs=1k count=2048 conv=fdatasync
(changed sdd to sdX to prevent users from copying it and harm their system)
But then I get a strange partition table:
# fdisk -l /dev/sdd
Medium /dev/sdd: 58,4 GiB, 62746787840 Bytes, 122552320 Sektoren
Einheiten: sectors von 1 * 512 = 512 Bytes
Sektorengröße (logisch/physisch): 512 Bytes / 512 Bytes
I/O Größe (minimal/optimal): 512 Bytes / 512 Bytes
Typ der Medienbezeichnung: dos
Medienkennung: 0x15e2543d
Gerät Boot Start Ende Sektoren Größe Id Typ
/dev/sdd1 * 0 3035519 3035520 1,5G 0 Leer
/dev/sdd2 14432 19295 4864 2,4M ef EFI (FAT-12/16/32)
This seems to be correct as my stick is booting fine. But I really don't understand it.
When I partion the usb device before and have one FAT32 and one LUKS parttion then I still can dd
the iso to the first partition /dev/sdd1
but it is not bootable anymore.
I set the bootable flag on the first partition of course an my laptop tries to boot it but only shows a blinking underscore.
There are so many misleading informations in the web about this scenario. I am lost. I am familiar with partitioning, and MBR and GRUB but only in using it. It seems I never really understood what is going on and many things have changed since I last did it (EFI, loop devices..)
It seems to be very difficult to use an USB stick as a bootable ubuntu AND as a backup partition. But I still think this should be a matter of
- Formatting and partitioning USB stick
- Copying ISO to partition
- Make some magic like MBR, bootable flag, Grub2
Can somebody help with a small step-by-step command line example to get things running on a modern ubuntu 16.04?
The second partition doesn't need to be mounted on Windows by the way.