Clonezilla back up / restore by machine number
Boot menu: "Clonezilla: back up this PC" and "restore this PC" ask for the machine number and boot Clonezilla (64-bit with Debian shim, or 32-bit i686 by cpuid) with ocs_repository=smb3://clonezilla:<pw>@server/clonezilla/, ocs_prerun fetching clonezilla-scripts/pxe-cz.sh and ocs_live_run running it. The script validates the machine number, saves <machine>-<YYYY-MM-DD-HHMM> (server time), writes pxe-meta.txt, runs ocs-chkimg, and restores only that machine's images with -k1 -r after a typed YES. The old entry is "Clonezilla: manual". Playbook: clonezilla Samba user for the [clonezilla] share only, password from clonezilla_smb_password (validated, filled into the menu placeholder), scripts installed to the web root. Webapp: Clonezilla backups page lists image folders and zips grouped by machine number with serial/model/version/check, serial mismatch flag, delete, move to another machine, streamed tar download, disk space bar and an explicit keep-last-N retention with preview. Tests and a VM test plan added.
This commit is contained in:
@@ -10,8 +10,10 @@ item --gap -- ---- Drive Erase ----
|
||||
item blancco Blancco Drive Eraser
|
||||
item blancco_debug Blancco Drive Eraser (debug / SSH)
|
||||
item --gap -- ---- Utilities ----
|
||||
item clonezilla Clonezilla Live (Disk Imaging)
|
||||
item clonezilla32 Clonezilla Live 32-bit (XP-era PCs, forced)
|
||||
item cz_backup Clonezilla: back up this PC
|
||||
item cz_restore Clonezilla: restore this PC
|
||||
item clonezilla Clonezilla: manual (USB or other location)
|
||||
item clonezilla32 Clonezilla: manual, 32-bit (XP-era PCs, forced)
|
||||
item --gap -- Memory test: Dell PCs press F12 at power-on, Diagnostics
|
||||
item --gap -- ----
|
||||
item reboot Reboot
|
||||
@@ -48,6 +50,47 @@ echo Windows PE boot FAILED (see the error above).
|
||||
echo Check that the PXE server is up and the win11 boot files are staged.
|
||||
prompt Press any key to return to menu... && goto menu || goto menu
|
||||
|
||||
# --- Clonezilla by machine number (back up / restore) ---------------------
|
||||
# The image share is \\${server}\clonezilla (Samba account clonezilla,
|
||||
# the playbook fills in its password). Clonezilla mounts it on
|
||||
# /home/partimag (ocs_repository, SMB 3), downloads
|
||||
# clonezilla-scripts/pxe-cz.sh (ocs_prerun) and runs it (ocs_live_run):
|
||||
# it checks the machine number, saves <machine>-<YYYY-MM-DD-HHMM> or lists
|
||||
# that machine's images to restore, and writes pxe-meta.txt.
|
||||
:cz_backup
|
||||
set cz_mode save
|
||||
goto cz_machine
|
||||
|
||||
:cz_restore
|
||||
set cz_mode restore
|
||||
goto cz_machine
|
||||
|
||||
:cz_machine
|
||||
# iPXE cannot check characters: pxe-cz.sh accepts letters, digits and dash
|
||||
# and asks again there. Empty: ask again. Esc / Ctrl-C: back to the menu.
|
||||
echo
|
||||
echo -n Machine number: && read czmachine || goto menu
|
||||
isset ${czmachine} || goto cz_machine
|
||||
# Same CPU check as the manual entry below (cpuid --ext 29 = 64-bit).
|
||||
cpuid --ext 29 && goto cz_auto64 || goto cz_auto32
|
||||
|
||||
:cz_auto64
|
||||
set base http://${server}/clonezilla
|
||||
kernel ${base}/vmlinuz boot=live username=user union=overlay config components noswap edd=on nomodeset nodmraid locales=en_US.UTF-8 keyboard-layouts=us ocs_prerun="wget -q -T 15 -t 5 -O /tmp/pxe-cz.sh http://${server}/clonezilla-scripts/pxe-cz.sh" ocs_repository="smb3://clonezilla:__CLONEZILLA_SMB_PASSWORD__@${server}/clonezilla/" echo_ocs_repository=no ocs_live_run="bash /tmp/pxe-cz.sh" ocs_live_extra_param="" ocs_live_batch=no net.ifnames=0 nosplash noprompt fetch=${base}/filesystem.squashfs pxe_cz_mode=${cz_mode} pxe_machine=${czmachine} pxe_end=1 || goto secureboot_warn
|
||||
initrd ${base}/initrd.img || goto boot_failed
|
||||
# Secure Boot ON: Debian's shim, as in :clonezilla64 below.
|
||||
shim ${base}/shimx64.efi ||
|
||||
boot || goto secureboot_warn
|
||||
|
||||
:cz_auto32
|
||||
# 3.2.0-5 i686 over legacy BIOS only; UEFI goes to the 64-bit build.
|
||||
iseq ${platform} efi && goto cz_auto64 ||
|
||||
set base http://${server}/clonezilla-i686
|
||||
kernel ${base}/vmlinuz boot=live username=user union=overlay config components noswap edd=on nomodeset nodmraid locales=en_US.UTF-8 keyboard-layouts=us ocs_prerun="wget -q -T 15 -t 5 -O /tmp/pxe-cz.sh http://${server}/clonezilla-scripts/pxe-cz.sh" ocs_repository="smb3://clonezilla:__CLONEZILLA_SMB_PASSWORD__@${server}/clonezilla/" echo_ocs_repository=no ocs_live_run="bash /tmp/pxe-cz.sh" ocs_live_extra_param="" ocs_live_batch=no net.ifnames=0 nosplash noprompt fetch=${base}/filesystem.squashfs pxe_cz_mode=${cz_mode} pxe_machine=${czmachine} pxe_end=1 || goto boot_failed
|
||||
initrd ${base}/initrd.img || goto boot_failed
|
||||
boot || goto boot_failed
|
||||
|
||||
# --- Clonezilla manual (interactive: USB, SSH, NFS or any share) ------------
|
||||
:clonezilla
|
||||
# 64-bit CPUs (cpuid extended bit 29 = long mode) get the current Clonezilla;
|
||||
# older 32-bit-only CPUs (Pentium 4 without EM64T, Pentium M, early Atom:
|
||||
|
||||
Reference in New Issue
Block a user