I found a way to get it to complete without error, my earlier problems were from:
a ) dd'ing a clone of only the timeshift partition, not the whole timeshift USB
and
b ) trying to restore it inside a VM, this time I restored on to a real HDD on a physically real computer instead
hence
NOW IT WORKS!!!
Guide included below so anyone interested can do it to.
Here's how to make the compressed image:
1. Create a timeshift snapshot of the system, with the various settings to copy home and other directories it normally wouldn't, but which you'll want to copy if you're to make the image contain programs (like exe files under wine) which live in a home directory. You'll probably want to copy hidden files (like the bash history) as well as all files.
2. Make this snapshot on the smallest USB which is big enough to fit it
3. I'd advise some restarting of the system and such at this point, in my use case it was months between making the timeshift USB and learning how to do the next bit. The next bit could also be done on a totally different system to the one on which the original timeshift USB was made.
4. Run
sudo dd if=/dev/sdX of=/home/username/timeshift_img/NameBackupSDB.img status=progress
with sdX being the name the USB gets given when plugged in (warning, it might have a different name depending what order you plug it in with compared to other devices connected at the time). It is very important to clone it as /dev/sdb, NOT as /dev/sdb1, you want the whole drive, not just the partition. Ensure you have spare HDD space big enough the whole USB's size before you begin.
5. Run, from inside the timeshift_img folder,
7z a SDBNameBackupCompressed.7z NameBackupSDB.img -p -mhe=on -mx=3
, mx=3 is useful here as it quickens the compressing by not trying to optimise too hard for file size
, mhe=on is optional, if you want to encrypt the backup, a wise move if your original timeshift snapshot had password files on the system which you copied and therefore now stored within it. Before running, ensure you have spare HDD space for a new 7z file sized to be a good proportion of the size of the img file.
6. That 7z, albeit potentially a rather big file, is now fully portable. You can save it on any drive, anywhere, with any formatting for the drive so long as it can cope with BIG files (30GB or so for the 7z in my use case) (so NTFS formatted filesystems, but not FAT32 or exFAT).
Here's how to use it:
7. Start by installing your Linux OS fresh on a new system, ensure you install Timeshift within it if Timeshift isn't supplied by default (it is there by default in Mint 21.1, where I tested this). When installing make sure to match partition names, sizes and order to that of the original system you are cloning.
8. Once the fresh install is done and rebooted, so you don't have the live USB for it plugged in any more, copy the 7z file on to this system, uncompress it with 7z either via terminal or via the GUI archive extraction file program so as to create an extracted copy of NameBackupSDB.img on the new system.
9. Get an extra USB, larger than the one originally used for storing the snapshot, and use dd to write the img file to it. It is vital this be bigger than the original, it absolutely must not be smaller. If the original USB was 62GB*, even if only 30GB was used, you need a USB >62GB here even though only the first 30GB of the img file is used. I hear rumours that many drives keep a partition table at the very back end of the drive, so writing an overly large img file overwrites this and makes the drive useless until you've used gparted to wipe it and write a new partition table. I definitely found this the case, I had a 61555605504 byte original USB containing a 57GB timeshift partition plus free space, I initially tried to dd the img to a drive which had a real capacity of 61,530,439,680 bytes, dd gave no errors, but the USB created could not be read even though the only partition which mattered in the drive I had cloned from was only 57GB. I had to use Gparted to make a new partition table, which wiped what I had just dd'd on to it. I retried with a drive which read as 64GB actual capacity, all was fine this time.
sudo dd if=ExtractedNameBackupSDB.img of=/dev/sdc status=progress
sdc here is for the new USB ( >(original size) )you are writing to. If your original was, for example, 62GB and you can't find a truly 64GB USB, use a 128GB here.
*here you notice how important the diferences of advertised capacity and actual can be, many 64GB USBs are 62GB or 58GB... and you also note the irritaing differences of GB vs GiB (Giga vs Gibi, 1000 based vs 1024 based) and how you're never really sure which of Gb and GiB any given program displays figures in and a USB is advertised as
10. Safely eject the USB and restart the freshly installed system
11. When you have restarted, start timeshift on the new system and set it NOT to take automated (daily, or other timeframe) snapshots
11.5. Turn OFF screensaver settings, tell the PC not to go to sleep, or lock the screen
12. Now plug in the USB which you dd'd the img file to, in Timeshift's settings tell Timeshift to look to that USB's partition as the place for snapshots
13. Leaving timeshift's settings alone, proceed to restore the snapshot from that USB
13.5. At the "select target device" stage pick the paths for "/" and "/home" to be the relevant sdaY and sdaZ partitions of the internal HDD, leave "/boot" and "/boot/efi" as "Keep on root device". In bootloder options select the defaults (do "(Re)install Grub2 on:" and pick your SDA hard drive as the device, do not pick a partition, do not update initramfs, do "update grub menu").
14. Timeshift will do its stuff, and then put the PC in to a state where the whole screen is taken up by a listing of the files Timeshift is restoring
15. Then it will try to restart, and then it will crash
16. Power down the PC, and boot from he live USB again
17. With the live USB booted, mount the root partition of the internal HDD, and run
sudo caja
to create an elevated privilege file browser.
18. Browse to /etc/fstab on the internal HDD's root partition and open it in the elevated privilege text editor
19. Open the Live USB's "Disks" program
20. Edit /etc/fstab so each UUID it presently shows is replaced by the appropriate UUID seen in the Disks window, copy and paste from the Disks window to the /etc/fstab text file each UUID, or the EFI partition, root partition, home partition and any others. Note, if there were a way to work the other way round, telling the live system what UUIDs you want for each partition at an earlier point in time, I'd be interested in understanding that option too if anyone can tell me of ways to choose the UUID during installation of the OS to the HDD while booted from a Live USB.
21. Shut down the PC, remove the Live USB, now boot normally, log in, and open Timeshift again. Note that during pre-login the desktop background will match any custom one you have set, but after login it will still look like the default used on the fresh install.
22. At this point some parts of the snapshot have been restored, but some haven't, now we'll get them all restored
23. When you open Timeshift now it will have all the correct folder filters as were used when your original snapshot was made. Plug in your timeshift snapshot USB, select it as the device to restore from under "Location". When restoring from it use the same "select target device" settings as you did earlier on.
24. Allow it to restore, and go to the screen of scrolling file names again, and shut itself down
25. This time when it restarts it will crash again, you'll need to use the live USB again to make the /etc/fstab changes
26. With those changes made, the same way as before, shut down
27. Then take out the live USB, power up, and you'll have a new system as a clone of the original, having been transferred via a fully portable 7z file
28. You can then wipe the USB used as the timeshift snapshot (wipe just the larger later one, or both of them) and use for normal file storage. You have a 7z file which can be used as a means of generating a timeshift partition USB when one is needed, but when it isn't needed you don't need to use up USB space with the timeshift snapshot, you can store it as just a file on a large enough ntfs partition within any data storage device you have to hand.
Hope this helps you.
Edited by rp88, 11 October 2023 - 08:52 PM.
Back to visiting this site, every so often, been so busy in previous years.