I built a clean, hardware-agnostic Recovery Wizard that works from the USB itself — both RESTORE and SAVE — without any hardcoded device names.
How it works (the flow)
GRUB dynamically finds the USB with search --set -f /live/vmlinuz and captures its permanent FAT32 UUID with probe -u $root --set=usb_uuid.
The UUID is injected into ocs_prerun1 so Clonezilla can temporarily mount the USB, copy script.sh locally, then unmount.
The bash script parses the exact same UUID from /proc/cmdline using a simple sed one-liner, runs fsck.fat, mounts the USB to /mnt/usb, and creates the required symlink /home/partimag → /mnt/usb/zBackup.
ocs_live_run then sees the images in the exact place Clonezilla expects → fully automated restore or save.
No LABELs, no static UUIDs in grub.cfg, no device names. Works even with extra hard drives plugged in.
1. GRUB EFI menu entries (add to /boot/grub/grub.cfg on the USB)
2. Bash script (/boot/grub/script.sh on the USB — make executable with chmod +x)
#!/bin/bash# =============================================# USB Mount folder script - UUID from ocs_prerun# =============================================# dynamically read the USB UUID that GRUB passed us from the ocs_prerun1 mount line in /proc/cmdlineusb_uuid=$(cat/proc/cmdline|sed-E's/.*mount -U ([0-9A-Fa-f-]+).*/\1/'|head-n1)echo"Detected USB UUID from ocs_prerun: $usb_uuid"if[-z"$usb_uuid"]||[[!"$usb_uuid"=~^[0-9A-Fa-f-]+$]];thenecho"ERROR: Could not extract UUID from ocs_prerun line!"cat/proc/cmdline|grep-o'mount -U [^ ]*'sleep10exit1fi# create mount folder to use
mkdir-p/mnt/usb
# fix common FAT32 'dirty' errors silently before mounting
fsck.fat-a/dev/disk/by-uuid/${usb_uuid}||true# Mount as FAT32 (vfat) - 'flush' helps prevent data loss if the USB is pulled early
mount-U${usb_uuid}-tvfat-orw,flush,umask=000/mnt/usb
# create a symbolic link to the mmb folder as /home/partimagcd/home
rm-r/home/partimag>/dev/null2>&1# this is safe even if already mounted as only symbolic link, also -r switch is safemmbdir="/mnt/usb/zBackup"linkmmbdir=(ln-fs"${mmbdir}"partimag)"${linkmmbdir[@]}"# validationif[-d"/home/partimag"];thenecho"SUCCESS: found folders on FAT32 drive."ls-F/home/partimag
elseecho"ERROR: folders not found – check mount below:"mount|grep-E'usb|partimag'fiecho"=== Script finished ==="
sleep3
Quick setup
Burn normal Clonezilla Live to USB (Etcher/Rufus).
Add the two menuentries to /boot/grub/grub.cfg.
Copy the script to /boot/grub/script.sh and chmod +x.
Put your images in the zBackup folder on the USB.
Boot → pick RESTORE or SAVE → fully automatic.
Tested on a Mac Mini (EFI) with extra drives plugged in — works perfectly every time.
Last edit: Ace Ventura 2026-05-30
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Great. Thanks for sharing that.
Another way to do that is, if you accept the have a label for your FAT32 partition on USB stick, say "OCS-REPO", then:
root@cl-20260525-s:~$ blkid /dev/sdd1
/dev/sdd1: LABEL_FATBOOT="OCS-REPO" LABEL="OCS-REPO" ...
root@cl-20260525-s:~$ mount -L OCS-REPO /home/partimag/
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I apologize if I'm writing off-topic information, because in this case we need: GRUB and a USB drive... but then it's also simpler and almost automatic: saving a system backup and restoring from the grub menu. More: https://github.com/ski007/grubzilla
👍
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I built a clean, hardware-agnostic Recovery Wizard that works from the USB itself — both RESTORE and SAVE — without any hardcoded device names.
How it works (the flow)
search --set -f /live/vmlinuzand captures its permanent FAT32 UUID withprobe -u $root --set=usb_uuid.ocs_prerun1so Clonezilla can temporarily mount the USB, copyscript.shlocally, then unmount./proc/cmdlineusing a simplesedone-liner, runsfsck.fat, mounts the USB to/mnt/usb, and creates the required symlink/home/partimag → /mnt/usb/zBackup.ocs_live_runthen sees the images in the exact place Clonezilla expects → fully automated restore or save.No LABELs, no static UUIDs in grub.cfg, no device names. Works even with extra hard drives plugged in.
1. GRUB EFI menu entries (add to
/boot/grub/grub.cfgon the USB)2. Bash script (
/boot/grub/script.shon the USB — make executable withchmod +x)Quick setup
/boot/grub/grub.cfg./boot/grub/script.shandchmod +x.zBackupfolder on the USB.Tested on a Mac Mini (EFI) with extra drives plugged in — works perfectly every time.
Last edit: Ace Ventura 2026-05-30
Great. Thanks for sharing that.
Another way to do that is, if you accept the have a label for your FAT32 partition on USB stick, say "OCS-REPO", then:
root@cl-20260525-s:~$ blkid /dev/sdd1
/dev/sdd1: LABEL_FATBOOT="OCS-REPO" LABEL="OCS-REPO" ...
root@cl-20260525-s:~$ mount -L OCS-REPO /home/partimag/
BTW, forgot to mention. You can also use the boot parameter to do that:
ocs_repository="dev:///LABEL=OCS-REPO"
Ref: https://clonezilla.org//fine-print-live-doc.php?path=./clonezilla-live/doc/99_Misc/00_live-boot-parameters.doc#00_live-boot-parameters.doc
I apologize if I'm writing off-topic information, because in this case we need: GRUB and a USB drive... but then it's also simpler and almost automatic: saving a system backup and restoring from the grub menu. More: https://github.com/ski007/grubzilla
Cool. Thanks for sharing that.