An USB stick able to store, and let us boot from several Linux distributions images is a very handy tool to have at our disposal. In a previous article we saw how to manually setup and create it from scratch; however, since such operation can quickly become tedious, in this tutorial we will see how to use Ventoy, a tool able to make all the dirty work for us.

In this tutorial you will learn:

  • How to download Ventoy
  • How to use Ventoy to setup a multiboot USB stick
  • How to test the multiboot device without rebooting with Qemu
ventoy_logo

Software requirements and conventions used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Distribution-independent
Software Ventoy, Qemu to test the device without rebooting
Other Administrative privileges needed to partition and setup the USB device
Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user

Step 1 - download Ventoy

Being Ventoy an open source project, its source code is hosted on github. We can decide to compile the software from source or download the pre-compiled code in the form of a tarball. In this tutorial we will use the latter solution. To download the latest release of the program, which at the moment of writing is 1.0.14, we can launch the following command:

$ curl -L https://github.com/ventoy/Ventoy/releases/download/v1.0.14/ventoy-1.0.14-linux.tar.gz \
  | tar -xmpz

The tarball will be downloaded and extracted in one step; in the end you should find a ventoy-1.0.14 directory created in your current location. From now on we will work inside it:

$ cd ventoy-1.0.14

SUBSCRIBE TO NEWSLETTER
Subscribe to Linux Career NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.


Step 2 - prepare the USB device

Ventoy will create a multiboot USB we can use to boot multiple distribution images, therefore we need to choose what USB device to use with it (to see all the current block devices attached to the system, we can use the lsblk command). Once we decided what USB device to use with Ventoy, we can prepare it using the Ventoy2Disk.sh script. To see the script “help” page, and learn about its syntax, we can run it as unprivileged users, without any arguments:

$ ./Ventoy2Disk.sh

The command produces this output:


***********************************************************
*                Ventoy2Disk Script                       *
*             longpanda  This email address is being protected from spambots. You need JavaScript enabled to view it.                 *
***********************************************************

Usage:  Ventoy2Disk.sh CMD [ OPTION ] /dev/sdX
  CMD:
   -i  install ventoy to sdX (fail if disk already installed with ventoy)
   -u  update ventoy in sdX
   -I  force install ventoy to sdX (no matter installed or not)

  OPTION: (optional)
   -r SIZE_MB  preserve some space at the bottom of the disk (only for install)
   -s          enable secure boot support (default is disabled)

As we can observe, the script takes the path of a raw block device (not a partition!) as its sole argument, and can be run in basically three “modes”: if we use -i as “CMD” the script will try to install Ventoy on the passed block device, but will fail if a previous installation already exists. To avoid this behavior and force installation no matter what we can use -I instead. If we use -u, an existent installation will be updated.

The script has also two options: -r takes as argument the size in MB to preserve at the end of the disk; -s enables secure boot support.

For the sake of this tutorial I will the /dev/sdc device on my system. To work correctly, the Ventoy2Disk.sh script, must be launched with administrative privileges:

$ sudo ./Ventoy2Disk.sh -i /dev/sdc

After running the command, the script will (double) prompt us to confirm the operation before proceeding, since all data on the selected device will be overwritten:

***********************************************************
*                Ventoy2Disk Script                       *
*             longpanda  This email address is being protected from spambots. You need JavaScript enabled to view it.                 *
***********************************************************

Disk : /dev/sdc
Model: Corsair Survivor 3.0 (scsi)
Size : 28 GB


Attention:
You will install Ventoy to /dev/sdc.
All the data on the disk /dev/sdc will be lost!!!

Continue? (y/n)y

All the data on the disk /dev/sdc will be lost!!!
Double-check. Continue? (y/n)y

As soon as we give confirmation, the script will start working. Two partitions will be created on the device: the first will take almost all the available space on the device, and will be formatted as exfat; the second will be used as esp, and formatted as vfat:

sdc                                            28.3G
├─sdc1                                         28.3G exfat
└─sdc2                                           32M vfat


Since the main partition is formatted as exfat, to be able to mount it in our distribution, the packages which provides support for this filesystem should be installed. In certain cases, like on the latest Fedora release, we may need to obtain the required software from external repositories In the case of Fedora, for example rpmfusion should be added to the software sources before installing the exfat-utils and fuse-exfat packages).

Step 3 - Copying the ISOs

Now that our USB device is ready, all we need to do is to place the ISOs we want to use inside its first partition. On the Ventoy website it’s possible to consult a list of tested ISOs (301 at the moment of writing) confirmed to work correctly. The images can be organized in subdirectories: Ventoy will search for them recursively and display them in alphabetical order on the generated GRUB menu. For the sake of this tutorial I will use two ISOs:

  • Clonezilla 2.6.4-10 i686 live
  • Fedora 32 server x86_64 netinstall

Step 4 - Test the USB device

We installed Ventoy and use it to create our multiboot device, then copied the images we want to include in our boot menu; all that remain to do now, is to test that our setup works correctly. To do that we don’t need to reboot our machine: we can test the USB device using Qemu.

To accomplish the task we need to locate our USB device hostbus and hostaddr. We can do it by launching the lsusb command and search for the appropriate device in its output. In my case, the device is the “Corsair Survivor Stealth Flash Drive”:

$ lsusb
Bus 002 Device 007: ID 1b1c:1a0a Corsair Survivor Stealth Flash Drive
[...]

From the output we can see that the device hostbus is 002 and hostaddr is 007. Now that we have all the necessary information, we can launch the following command:

$ sudo qemu-system-x86_64 -m 512 -enable-kvm -usb -device usb-host,hostbus=2,hostaddr=7

If everything is ok, at this point, a new window should be opened where we should be able to see the Ventoy-generated grub menu with the lines relative to the images we copied in the previous steps.

ventoy-grubmenu

Conclusions

Creating a multiboot USB device it’s very easy using the Ventoy tool: in this tutorial we saw how to download the software and use it to format and setup the USB stick which will hosts all our ISOs, and how to test it without rebooting our machine using Qemu. Ventoy uses exfat to format the main USB stick partition, therefore we should make sure the software needed to support said filesystem is installed on our distribution.

FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in:



Comments and Discussions