This old question sounds like what I want: Copy ubuntu.iso to Usb Stick with two partitions
It's marked as a duplicate of: How do I install Ubuntu to a USB key? (without using Startup Disk Creator)
But the answers all answer a different question, how to create a bootable USB with multiple partitons.
I don't want something that is simply bootable; I want to have something that can be used to install Ubuntu (what I would get if I simply used dd
to copy the iso) but the USB stick should also have one or more writable partitions in addition to what is in the iso.
Another possible solution is to use Ventoy. Directly from the tool description:
I have created a bootable USB where I have copied my Ubuntu ISO files simply with a copy/paste procedure, so that they are shown in a menu when the USB stick is used as a bootable drive. At the same time, I can use this USB also to store my personal data (they do not appear in the Ventoy Menu).
This means that when I use this USB stick as a bootable drive I have a menu like this (screenshot taken from the official website):
When I open it via Nautilus, it is like a normal USB stick where you can put your files (screenshot taken from my Ubuntu 20.04):
Ventoy does not come in a deb format or with an installation script, so you need to download Ventoy from the release page. If you download the
.tar.gz
version (I'll refer to version 1.0.61 in the following examples), you can extract it by issuing in the terminal:sudo tar xzf ventoy-1.0.61-linux.tar.gz -C /opt
Considering the meaning of /opt folder, I think that
/opt
is the best choice in terms of destination folder.Now, you need to give permissions to at least
Ventoy2Disk.sh
andVentoyGUI.x86_64
:sudo chmod +x /opt/ventoy-1.0.61/Ventoy2Disk.sh /opt/ventoy-1.0.61/VentoyGUI.x86_64
Now you are ready to use it. To create a bootable USB mapped as
/dev/usb
(always uselsblk
to identify correctly your USB disk!) with a GPT partitioning, you can runsudo bash /opt/ventoy-1.0.61/Ventoy2Disk.sh -I -g /dev/sdb
Following, the list of parameters provided by
Ventoy2Disk.sh
:Otherwise, you can run Ventoy with a graphical interface using:
sudo /opt/ventoy-1.0.61/VentoyGUI.x86_64
Further details are available in Ventoy Installation.
Another interesting source is this article from RedHat.com: Creating a multi-boot Linux desktop system
Partition the pendrive as you like, giving space for the ISO image in a FAT partition, the first one.
Run
lsblk
to identify which device is your pendrive, i.e/dev/sdb
, being the first partition the FAT one, i.e/dev/sdb1
. Mount it, i.e/media/user/PENDRIVE
Mark this partition as bootable, you can do this from Disks utility.
Run these commands:
wait until the commands are finished.
Unmount the binded dirs and remove them:
Create a file
grub.cfg
under/media/user/PENDRIVE/grub/
with ther content:Mount the Ubuntu ISO and copy the
grub.cfg
file in/media/user/PENDRIVE/boot/grub/
Alter the file¹, in this example with
ubuntu-20.04.1-desktop-amd64.iso
Ready, you have now an EFI/i386 bootable pendrive with the partitions you created.
¹ You can alter all the entries an leave the rest untouched, in my example I'm simplifying.
Simple Hand Made Persistent USB
If you like learning experiences, you can create a multi partition, persistent USB that can install Ubuntu, from scratch.
Install grub, if in BIOS mode or booted from Live USB drive run:
If in UEFI mode on installed system, boot into the Target drive and run the above commands.
*Booting based on mkusb by sudodus