I can only give you approximate untested instructions:
Assuming:
/dev/sda3 - old Qubes OS encrypted LVM
/dev/sdb1 - temporary backup drive and assuming its filesystem support creating sparse files (e.g. ext4) (Sparse file - ArchWiki) or has enough space to contain the VM raw images
Mount your backup drive, decrypt old Qubes OS system and activate VG:
mkdir /mnt/qubes-backup
mount /dev/sdb1 /mnt/qubes-backup
mkdir /mnt/qubes-backup/old-qubes-os-backup
cryptsetup luksOpen /dev/sda3 luks-old-qubes
vgchange -ay
Copy all the volumes from the old Qubes OS system to temporary backup drive:
Use this script to back up your qubes, create it somewhere and run it:
#!/bin/bash
# Get the list of volumes
qubes_dom0_vms=$(find /dev/qubes_dom0/ -type l | grep -e '/dev/qubes_dom0/vm-.*-private$' -e '/dev/qubes_dom0/vm-.*-root$')
for qubes_dom0_vm in $qubes_dom0_vms
do
echo "Processing volume $(basename $qubes_dom0_vm)"
dd if=$qubes_dom0_vm of=/mnt/qubes-backup/old-qubes-os-backup/$(basename $qubes_dom0_vm).img bs=1M conv=sparse
echo "DONE $(basename $qubes_dom0_vm)"
done
After running it all your qubes are backed up and you can install a new Qubes OS system.
Once you’ve installed your new Qubes OS system, install templates all over again from the default ones.
Now you’ll have to manually restore all your qubes.
An example of how to restore a qube with a name testqube:
Note: It’s better to do this by attaching the /dev/sdb1 and your new empty qubes private storage to some offline disposable VM and copying the disk images there, but for simplicity I’ll explain it with /dev/sdb1 in dom0.
Assuming that you’ve booted into new Qubes OS and you have your temporary backup drive available as /dev/sdb1 in dom0.
mkdir /mnt/qubes-backup
mount /dev/sdb1 /mnt/qubes-backup
Find the size of your old testqube private storage:
ls -l --block-size=G /mnt/qubes-backup/old-qubes-os-backup/vm-testqube-private.img
Create new empty qube and change its private storage size to your old testqube size. Also change all the new testqube settings to the old ones (memory, CPU count, firewall rules, menu apps etc).
Copy the old private image of testqube over the new empty private image of testqube:
dd if=/mnt/qubes-backup/old-qubes-os-backup/vm-testqube-private.img of=/dev/qubes_dom0/vm-testqube-private bs=1M
For StandaloneVM you also need to copy the root, but it’s can be done during qube creation:
qvm-create --root-copy-from=/mnt/qubes-backup/old-qubes-os-backup/vm-testqube-root.img --label red testqube
And copy its private image after this.
Done.