BUILD A PORTABLE MULTIBOOT & BACKUP SSD
Overview
Provisioning a bare metal server can be done in different ways:
- In an already established infrastructure, having a PXE server and using prebuilt images or leveraging setup automation (e.g. kickstart in the Red Hat family) is one option;
- When starting from scratch, or when practicing homelabbing, a boot disk is the usual solution.
We'll focus on the second option here, boot disks; USB keys are often used for this purpose, but they are limited in storage size and can also be somewhat unreliable in the long term. Fortunately we now have SSDs, with form factors, such as M.2, are adequate as better alternative.
On top of the multiboot part, given that any SSD is likely to have plenty of space, another interesting use case is to allocate an additional partition for data backup needs — allowing to carry a single multi-purpose portable storage instead of multiple ones.
Assembling the Hardware
To get the equivalent of a USB key with a SSD, only an enclosure (with a USB connector) is needed.
As a reminder, when choosing one, two points need to be checked:
- The physical format, e.g. 3.5", or 2.5" M.2 22xx
- The connection type, e.g. SATA or NVMe — most recent enclosures are NVMe only, older ones are SATA, some are compatible with both
Assembling the disk and the enclosure is trivial: just plug the disk into the enclosure connector and screw everything back.
Setup SSD
We'll use Ventoy as multiboot manager.
Ventoy offers the option to reserve space for extra partitions, besides its layout, with the -r $SIZE
flag, as documented on this page, which fits our needs.
From macOS
The Ventoy installation script is not available for macOS, spin up a VM using, e.g. Parallels Desktop with any recent distribution
Plug in the SSD/USB adapter, Parallels Desktop will ask where you want to access it (host or guest(s)), click Allow for the guest.
From the guest, follow the "From Linux" section.
From Linux
Download the Ventoy tarball.
Find the device name corresponding to the SSD/USB adapter, typically /dev/sdb
as the VM probably only has one disk /dev/sda
; we will denote this value $DEVNAME
.
Run the Ventoy installer:
-i
: install (use-I
to force and overwrite the existing content, double check everything before doing so)-g
: use GPT (UEFI) partitioning scheme, we need this to use APFS later on our extra partition-r $((128*1024))
reserve 128G for extra partitions
Now create the extra partition using the reserved space:
Commands:
p
to print the partition tablem
for helpn
to add the new partition (you can leave all the default values, this will fill up the disk)w
to write and quit.
If you plan to use the extra partition from Linux, format it with whatever filesystem you prefer (ext4, etc.), on macOS you can use the Disk Utility app and format the partition with APFS/Encrypted, which is adequate for backups.
Populate Multiboot Catalog
Fill-in the Ventoy
partition (vfat) with your favorite images.
They will be listed in the Grub menu when you boot on the device.
Configure Backup Trigger
If you use a command line tool to handle your backups (e.g. Borg), triggering the creation of a snapshot when plugging the SSD/USB adapter is pretty convenient.
On macOS
From macOS 26 (Tahoe), the Shortcuts app allows to trigger shortcuts on system events, including plugging in an external drive.
To implement the backup trigger, in the Shortcuts app:
- Click on Automation in the left hand sidebar, then click "+"
- Choose "External Drive", then "Specific External Drive", "Choose Drive", select the mountpoint in
/Volumes
and Next - As action, Pick up "Run shell script" and fill in with the appropriate commands to perform the backup
On Linux
On Linux, udev can be used.
First, create a script, denoted $SCRIPT_PATH
, handling the backup, if you use only one command, you can skip this.
First, fetch the device ids, vendor and product, from the output of:
Then create a new file in /etc/udev/rules.d
:
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="XXXX", ATTR{idProduct}=="YYYY", RUN+="$SCRIPT_PATH"
Update the udev service:
Unplug and re-plug the device, the script should be executed.