Ok, the backup using gzip is done. It took 3 hours 36 minutes for a 1 TB drive. The original drive size was 1,000,204,886,016 bytes, the compressed file is 39,953,358,850 bytes, giving a compression ratio of 25.034312879 : 1.
Not quite as compressed as the built-in tar.xz compression.
[EDIT]
The gzip chained to dd doesn't work. It makes a tar.gz file, but that file appears to be corrupted, it won't open. I'm now experimenting with 7zip (7z)... I'm still generating the file, but it's going fast and it's using all the CPUs.
[EDIT 2]
Ok, the backup with 7zip and dd chained together took 3 hours 28 minutes for a 1 TB drive; the source drive is 1,000,204,886,016 bytes, the compressed file is 28,479,992,539 bytes, giving a compression ratio of 35.119562782 : 1. The compressed file can be extracted, so that works.
Boot Zorin OS on USB stick. (Reboot, press F9, select Boot from CD or Boot from USB, whichever your Zorin OS is on.)
TO BACK UP:
sudo dd if=/dev/sda conv=sync bs=128M iflag=fullblock oflag=sync,direct status=progress | sudo 7z a -mx9 -bd -si -mmt12 /media/zorin/Storage/$(date +%Y_%m_%d-%H_%M)_sda.tar.7z
Why bs=128M? Because the ideal size is equal to the hard drive on-board cache, if you have sufficient memory to run with that large a bs. Default is 512 bytes. You'll have to change that to whatever on-board cache your hard drive has.
You'll have to manually change the drive node and path to your drive, and the drive node in the output file name (bolded above). You'll also have to change the -mmt
setting to reflect the number of CPU cores your machine has (if you have HyperThreading enabled, double the number of physical cores; if you have HyperThreading disabled, the number of physical cores; if you want to limit how hard your processor is hit, then you can use fewer than that maximum, but it'll slow down the backup process).
TO EXTRACT:
sudo 7z x /media/zorin/Storage/2022_12_10-01_49_sda.tar.7z -mmt12 -o/media/zorin/Storage/
You'll have to manually change the path to the compressed file, and the path to save the uncompressed, extracted file to (bolded above).
You'll note I got the automatic file date / time thing working when backing up.
So the compressed file will be saved as, for example:
2022_12_10-01_49_sda.tar.7z
That's YYYY_MM_DD-HH_MM format, with the device node for the backed-up drive appended.
[EDIT 3]
I've changed the date format so it more closely reflects what the resultant file looks like when you image a drive in the Disks application.
sda_$(date +%Y-%m-%d_%H%M).tar.7z
Now it looks like: sda_YYYY-MM-DD_HHMM (ie: sda_2022-12-10_1445.tar.7z)
You'd change the 'sda' bit to reflect the device node of the drive you're backing up (ie: sdb, sdc, sdd, etc.), but otherwise leave the file name as it is. If you're only backing up a partition (rather than the entire drive), you could use, for instance, sda1 or sda2 or sda3, etc. That way you can sort the files by where they were backed up from, then by the date.