Adding kernel parameters to Clonezilla
I went to try using Clonezilla to backup an internal SSD disk, to a hot-plugable SATA HD in my new Silverstone FS204 4 bay SATA cage.
I found that Clonezilla was not detecting any of the pluggable disks in my cage.
So the Debian 12, on which Clonezilla is based, must require the kernel boot parameter intel_iommu=off
as determined here
I tried to edit the live Clonezilla by going into the shell, but it is a read only filesystem, even if I use the Ram option.
So, I decided to make my own Clonezilla bootable .iso file.
Getting a working copy of Clonezilla
I downloaded the file clonezilla-live-3.1.2-9-amd64.zip
.
I chose the .zip file because that is more easily edited than the .iso file.
I made a work directory, put the .zip file there and unzipped it
$ unzip clonezilla-live-3.1.2-9-amd64.zip
Archive: clonezilla-live-3.1.2-9-amd64.zip
creating: home/
creating: home/partimag/
creating: syslinux/
inflating: syslinux/menu.c32
inflating: syslinux/syslinux.cfg
inflating: syslinux/drblwp.png
inflating: syslinux/ldlinux.c32
inflating: syslinux/iso_sort.txt
inflating: syslinux/isolinux.cfg
..... snip .....
inflating: boot/grub/x86_64-efi/nativedisk.mod
inflating: boot/grub/x86_64-efi/lsacpi.mod
inflating: boot/grub/unicode.pf2
inflating: Clonezilla-Live-Version
Here is what it contains
nevj@trinity:~/Clonezilla
$ ls -F
amd64-release.txt boot/ Clonezilla-Live-Version EFI/ GPL home/ live/ syslinux/ utils/
I have removed the zip file
One can get the above files from a clonezilla .iso file, instead of from the.zip file.
One needs to make a loop mount
sudo mount /home/nevj/clonezilla-live-3.1.0-22-amd64.iso /mnt -o loop
then copy the filesystem to the workspace
cd /mnt
cp -r * ~/CZiso
cp -r .disk ~/CZiso
They are identical to the files in the .zip archive
Editing the working copy of Clonezilla
The two directories of interest are boot/grub/ and syslinux/
$ ls -F boot/grub
boot-local-efi.cfg efi.img i386-efi/ theme.cfg x86_64-efi/
config.cfg grub.cfg ocswp-grub2.png unicode.pf2
nevj@trinity:~/Clonezilla
$ ls -F syslinux
boot-local-efi.cfg drblwp.png isolinux.cfg ldlinux.c32 libutil.c32 menu.c32 syslinux.cfg
chain.c32 isolinux.bin iso_sort.txt libcom32.c32 memdisk ocswp.png vesamenu.c32
I need to edit the files syslinux.cfg and isolinux.cfg.
I will also edit grub.cfg because I am not sure if it is automatically generated
So in syslinux.cfg there is a section correspoding to the Clonezilla menu option that I useā¦ it is called Safe Graphic Settings. (the Clonezilla startup menu has several entries for various video modes with and without a Ram load.)
label Clonezilla live without framebuffer
# MENU DEFAULT
# MENU HIDE
MENU LABEL Clonezilla live (Safe graphic settings, vga=normal)
# MENU PASSWD
kernel /live/vmlinuz
append initrd=/live/initrd.img boot=live union=overlay username=user config components quiet loglevel=0 noswap edd=on nomodeset enforcing=0 noeject locales= keyboard-layouts= ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_batch="no" ip= net.ifnames=0 nomodeset vga=normal nosplash intel_iommu=off
TEXT HELP
Disable console frame buffer support
ENDTEXT
that is the one section that I use (Safe graphic settings, vga=normal) , and you can see I have added intel_iommu=off
I do the same in isolinux.cfg
label Clonezilla live without framebuffer
# MENU DEFAULT
# MENU HIDE
MENU LABEL Clonezilla live (Safe graphic settings, vga=normal)
# MENU PASSWD
kernel /live/vmlinuz
append initrd=/live/initrd.img boot=live union=overlay username=user config components quiet logl
evel=0 noswap edd=on nomodeset enforcing=0 locales= keyboard-layouts= ocs_live_run="ocs-live-genera
l" ocs_live_extra_param="" ocs_live_batch="no" ip= net.ifnames=0 nomodeset vga=normal nosplash intel_iommu=off
TEXT HELP
Disable console frame buffer support
ENDTEXT
Similarly in grub.cfg
menuentry "Clonezilla live Safe graphic settings (vga=normal)"{
search --set -f /live/vmlinuz
$linux_cmd /live/vmlinuz boot=live union=overlay username=user config components quiet loglevel=0 noswap edd=on nomodeset enforcing=0 noeject locales= keyboard-layouts= ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_batch="no" ip= net.ifnames=0 nomodeset vga=normal nosplash intel_iommu=off
$initrd_cmd /live/initrd.img
}
That is all. I just need to put it on a bootable .iso file and copy it to a flash drive for use.
Making a bootable usb drive
First attempt - failure
According to the Clonezilla instructions ā¦ I just need to copy the contents of my work directory to a formatted USB drive., and it will be uefi bootable.
The usb drive needs to contain one fat32 partiton with esp and boot flags, large enough to contain clonezilla (500Mb)
I mount the usb drive partiton
sudo mount /dev/sdi1 /mnt
and copy my workspace files onto it
sudo cp -r * /mnt
sudo cp -r .disk /mnt
It copied all the files. Basically what it does is put the whole of Clonezilla in the EFI system partition.
Lets see if it will boot ?
The bios boot menu has 2 items
USB DISK 2.0 PMAP
UEFI USB DISK 2.0 PMAP
The second is the UEFI bootā¦ it does not boot, it reverts to my machineās grub menuā¦ that means it does not think the flash drive is bootable
Second attempt - success
So lets make a bootable .iso file instead.
The tool for that is genisoimage
.
Here is my command to build an iso from the edited Clonezilla files.
$ genisoimage -r -J -l -iso-level 4 -cache-inodes -allow-leading-dots -allow-lowercase -allow-multidot -joliet-long -V MYCZ -c syslinux/boot.cat -b syslinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -no-emul-boot -o myclonezilla.iso ~/Clonezilla
Warning: creating filesystem that does not conform to ISO-9660.
Warning: Creating ISO-9660:1999 (version 2) filesystem.
Warning: ISO-9660 filenames longer than 31 may cause buffer overflows in the OS.
Size of boot image is 4 sectors -> No emulation
2.35% done, estimate finish Mon Nov 25 17:19:09 2024
4.70% done, estimate finish Mon Nov 25 17:19:09 2024
7.05% done, estimate finish Mon Nov 25 17:19:09 2024
.....
96.24% done, estimate finish Mon Nov 25 17:19:10 2024
98.59% done, estimate finish Mon Nov 25 17:19:10 2024
Total translation table size: 2048
Total rockridge attributes bytes: 52323
Total directory bytes: 108544
Path table size(bytes): 254
Max brk space used 78000
213007 extents written (416 MB)
Yes, there are a few commandline options for genisoimage.
That was my seventh try!
Now let us inspect the output
$ file myclonezilla.iso
myclonezilla.iso: ISO 9660 CD-ROM filesystem data 'MYCZ' (bootable)
It says bootable, so that is encouraging.
The ultimate test is to make it a proper āhybridā iso file using the ishybrid
command
cp myclonezilla.iso myclonezilla.iso.safe
$ isohybrid myclonezilla.iso
Silentā¦ that is good news. Make a copy first because isohybrid overwrites the file.
Lets check the file again
$ file myclonezilla.iso
myclonezilla.iso: ISO 9660 CD-ROM filesystem data (DOS/MBR boot sector) 'MYCZ' (bootable)
Ah, yes, now it has a boot sectorā¦ it may work.
All that remains is to dd
it to a usb drive
root@trinity:/home/nevj# dd if=myclonezilla.iso of=/dev/sde conv=fsync
852016+0 records in
852016+0 records out
436232192 bytes (436 MB, 416 MiB) copied, 89.3195 s, 4.9 MB/s
Finished.
Reboot , choose the usb drive in the bios, and we get the Clonezilla Startup Menu.
Success!
The final ultimate test
Well was adding intel_iommu
successful.?
I went down the Clonezilla menu to the second last option āSafe Graphic Settingsā
started Clonezilla, and worked down to the point where it finds all the disks in your systemā¦ it now finds the disks in my hotplug sata cage.
So I can actually now use Clonezilla to backup to a removable sata disk, instead of an external usb disk. More on that later