<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Backup on Bastien Traverse</title>
    <link>https://bastientraverse.com/en/tags/backup/</link>
    <description>Recent content in Backup on Bastien Traverse</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Tue, 05 Apr 2022 00:00:00 +0200</lastBuildDate><atom:link href="https://bastientraverse.com/en/tags/backup/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Moving an existing install into a virtual machine</title>
      <link>https://bastientraverse.com/en/posts/2022-04/physical-to-virtual/</link>
      <pubDate>Tue, 05 Apr 2022 00:00:00 +0200</pubDate>
      
      <guid>https://bastientraverse.com/en/posts/2022-04/physical-to-virtual/</guid>
      <description>&lt;p&gt;This a follow-up to my &lt;a href=&#34;https://bastientraverse.com/en/posts/2022-02/system-imaging/&#34;&gt;tale of a system image&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For fun and convenience, I now wanted to have a bootable image of my old laptop.&lt;/p&gt;
&lt;p&gt;So at first I thought of making a Live ISO out of it, but didn&amp;rsquo;t know the name of the process. I tried a few searches like &amp;ldquo;convert a configured system into ISO&amp;rdquo; or &amp;ldquo;create live ISO from running system&amp;rdquo;, but what I found looked strangely difficult and didn&amp;rsquo;t seem to really address my need.&lt;/p&gt;
&lt;p&gt;Then in the course of writing the aforementioned post, I was reminded of an Archwiki article I had seen some time ago: &lt;a href=&#34;https://wiki.archlinux.org/title/Moving_an_existing_install_into_%28or_out_of%29_a_virtual_machine&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Moving an existing install into (or out of) a virtual machine&lt;/a&gt;. This was exactly what I wanted, as I didn&amp;rsquo;t need a Live ISO so much as a VM that I could boot on my main machine whenever I wanted to check something, or bask nostalgically into the glow of my &lt;a href=&#34;https://flathub.org/apps/details/im.bernard.Nostalgia&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;old wallpaper&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Looking into it, I stumbled upon &lt;a href=&#34;https://clonezilla.org/lecture-materials/017_Canonical_FE_SE_Sprint_Event_in_June_2014/talk/P2V-by-Clonezilla.pdf&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;presentation slides&lt;/a&gt; by Clonezilla and learned that this process had a name: &amp;ldquo;Physical-to-Virtual&amp;rdquo;, or P2V for short (&lt;a href=&#34;https://developer.ibm.com/tutorials/l-clonezilla/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;here&lt;/a&gt; is another article by IBM from 2009 about this topic).&lt;/p&gt;
&lt;h2 id=&#34;the-ultimate-os-conservation-project-virtualizing-to-immortality&#34;&gt;&lt;a href=&#34;#the-ultimate-os-conservation-project-virtualizing-to-immortality&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;The ultimate OS conservation project: virtualizing to immortality&lt;/h2&gt;&lt;p&gt;Indeed, with a VM image of your old install you can easily keep it around forever, as with the specifications of the machine written down into an &lt;a href=&#34;https://libvirt.org/format.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;.xml file&lt;/a&gt; or in a QEMU command line invocation, you can spin one up at will.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ll use this opportunity to simplify my system stack, namely to rid it of both LUKS and LVM and consolidate all the existing logical volumes into one single filesystem.&lt;/p&gt;
&lt;p&gt;So how do we go about turning our physical system into a functional VM? Here is a rough outline of the process:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Preparing the VM image&lt;/li&gt;
&lt;li&gt;Transferring the data&lt;/li&gt;
&lt;li&gt;Making the necessary adjustments&lt;/li&gt;
&lt;li&gt;Profit&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;admonition info&#34;&gt;&lt;p class=&#34;admonition-title&#34;&gt;Note&lt;/p&gt;
  &lt;p&gt;There are different ways to approach steps 1 &amp;amp; 2 depending on what you are working with, &lt;em&gt;e.g.&lt;/em&gt; your target &lt;a href=&#34;https://wiki.archlinux.org/title/Category:Hypervisors&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;hypervisor&lt;/a&gt;, what kind of &lt;a href=&#34;https://wiki.archlinux.org/title/Synchronization_and_backup_programs&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;backup/file transfer program&lt;/a&gt; is available to you and whether or not you need to modify the image.&lt;/p&gt;
&lt;p&gt;If you need to do &lt;em&gt;any&lt;/em&gt; modifications to the partitions/filesystems, forget about Clonezilla/partclone/FSArchiver &lt;code&gt;savepart&lt;/code&gt; mode and use a file-level transfer method.&lt;/p&gt;
&lt;p&gt;Since this is my case I&amp;rsquo;ll describe this approach, but if &lt;em&gt;e.g.&lt;/em&gt; for you the physical and virtual machines are connected via the network and no modifications are needed, then &lt;a href=&#34;https://sourceforge.net/p/clonezilla/discussion/Help/thread/b07125e0/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Clonezilla remote device cloning&lt;/a&gt; could work great.&lt;/p&gt;
&lt;p&gt;(Heck, if no modifications are needed you could even just use a loopback file mounted on &lt;code&gt;/home/partimag&lt;/code&gt; in the live environment on the physical machine and have &lt;a href=&#34;https://clonezilla.org/show-live-doc-content.php?topic=clonezilla-live/doc/03_Disk_to_disk_clone&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Clonezilla make a local clone&lt;/a&gt;!)&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Here I will target QEMU for the hypervisor as that&amp;rsquo;s what I use, but only little adjustments should be required for other hypervisors.&lt;/p&gt;
&lt;p&gt;All right, let&amp;rsquo;s delve into it!&lt;/p&gt;
&lt;h2 id=&#34;step-1-preparing-the-vm-image&#34;&gt;&lt;a href=&#34;#step-1-preparing-the-vm-image&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Step 1: Preparing the VM image&lt;/h2&gt;&lt;p&gt;Here we will create and prepare the image file which will be used as the VM drive.&lt;/p&gt;
&lt;p&gt;In this case I will directly create and work with QEMU &lt;a href=&#34;https://en.wikipedia.org/wiki/Qcow&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;qcow&lt;/a&gt; format, but will also illustrate how to do it all with a &lt;a href=&#34;https://en.wikipedia.org/wiki/IMG_%28file_format%29&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;raw image&lt;/a&gt; file which can be later &lt;a href=&#34;https://docs.openstack.org/image-guide/convert-images.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;converted&lt;/a&gt; to the desired format if needed.&lt;/p&gt;
&lt;h3 id=&#34;creating-the-file&#34;&gt;&lt;a href=&#34;#creating-the-file&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Creating the file&lt;/h3&gt;&lt;p&gt;First we create an image of an appropriate size&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;h4 id=&#34;qcow-image&#34;&gt;&lt;a href=&#34;#qcow-image&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;qcow image:&lt;/h4&gt;&lt;pre&gt;&lt;code&gt;qemu-img create -f qcow2 -o cluster_size=2M --prealocation=falloc p2v.qcow2 15G
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;admonition note&#34;&gt;
  The &lt;code&gt;-o cluster_size=2M&lt;/code&gt; option is used to &lt;a href=&#34;https://events19.lfasiallc.com/wp-content/uploads/2017/11/Storage-Performance-Tuning-for-FAST-Virtual-Machines_Fam-Zheng.pdf&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;increase&lt;/a&gt; &lt;a href=&#34;https://www.heiko-sieger.info/tuning-vm-disk-performance/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;performance&lt;/a&gt;.
&lt;/div&gt;
&lt;p&gt;Then we make the image &lt;a href=&#34;https://wiki.archlinux.org/title/QEMU#Mounting_a_partition_from_a_qcow2_image&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;available to the system&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo modprobe nbd max_part=1
sudo qemu-nbd -c /dev/nbd0 p2v.qcow2
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&#34;raw-image&#34;&gt;&lt;a href=&#34;#raw-image&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Raw image:&lt;/h4&gt;&lt;p&gt;On file systems supporting it (ext4, XFS, Btrfs, FAT – &lt;a href=&#34;https://github.com/arter97/exfat-linux/issues/25&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;but not exFAT&lt;/a&gt;), &lt;a href=&#34;https://man.archlinux.org/man/core/util-linux/fallocate.1.en&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;fallocate&lt;/a&gt; is &lt;a href=&#34;https://stackoverflow.com/a/11779492&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;the best choice&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;fallocate -l 20G p2v.img
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For systems without fallocate but &lt;a href=&#34;https://wiki.archlinux.org/title/Sparse_file&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;sparse file&lt;/a&gt; support, use &lt;a href=&#34;https://man.archlinux.org/man/core/coreutils/truncate.1.en&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;truncate&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;truncate -s 20G p2v.img
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If even sparse files are too much to ask, then it&amp;rsquo;s time to get the &lt;a href=&#34;https://opensource.com/article/18/7/how-use-dd-linux&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;disk destroyer&lt;/a&gt; out (warning: might take a while):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;dd if=/dev/zero of=p2v.img bs=1M count=20000
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you really don&amp;rsquo;t want to know/choose and have QEMU installed, let it handle the details for you:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;qemu-img create p2v.img 20G
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;partitioning&#34;&gt;&lt;a href=&#34;#partitioning&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Partitioning&lt;/h3&gt;&lt;p&gt;Now to &lt;a href=&#34;https://wiki.archlinux.org/title/Partitioning&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;partition&lt;/a&gt; our image. It is easier to use the same &lt;a href=&#34;https://wiki.archlinux.org/title/Partitioning#Partition_table&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;partition table type&lt;/a&gt; as your physical machine (MBR or GPT), except if you want to &lt;a href=&#34;https://wiki.archlinux.org/title/GPT_fdisk#Convert_between_MBR_and_GPT&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;convert&lt;/a&gt; it of course.&lt;/p&gt;
&lt;div class=&#34;admonition warning&#34;&gt;&lt;p class=&#34;admonition-title&#34;&gt;Warning&lt;/p&gt;
  All of the following commands must be run with elevated privileges. Be careful with what you execute. Replace &lt;code&gt;/dev/nbd0&lt;/code&gt; with &lt;code&gt;p2v.img&lt;/code&gt; (or whatever you named it) if using a raw disk image.
&lt;/div&gt;
&lt;h4 id=&#34;mbr&#34;&gt;&lt;a href=&#34;#mbr&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;MBR&lt;/h4&gt;&lt;p&gt;Here is the simplest way &lt;a href=&#34;https://superuser.com/questions/332252/how-to-create-and-format-a-partition-using-a-bash-script/1132834#1132834&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;I found&lt;/a&gt; to create a single partition with MBR scheme aligned on the 1 MB boundary (with the default &lt;a href=&#34;https://en.wikipedia.org/wiki/Partition_type&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;partition type&lt;/a&gt; for GNU/Linux).&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;printf &#39;,&#39; | sfdisk /dev/nbd0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Crazy right? If that (rightly) scares you, I&amp;rsquo;ve got an equivalent, more &lt;em&gt;spelled-out&lt;/em&gt; &lt;code&gt;parted&lt;/code&gt; one-liner:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;parted --script --align optimal /dev/nbd0 mklabel msdos mkpart primary 1 100%
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&#34;gpt&#34;&gt;&lt;a href=&#34;#gpt&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;GPT&lt;/h4&gt;&lt;p&gt;And here are their GPT equivalents (with &lt;a href=&#34;https://www.rodsbooks.com/gdisk/sgdisk-walkthrough.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;sgdisk&lt;/a&gt; thrown into the mix):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;printf &#39;,&#39; | sfdisk --label gpt /dev/nbd0
sgdisk --largest-new 0 /dev/nbd0
parted --script --align optimal /dev/nbd0 mklabel gpt mkpart $name 1 100%
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;admonition tip&#34;&gt;
  See the &lt;code&gt;$name&lt;/code&gt; in that &lt;em&gt;parted&lt;/em&gt; command here? That&amp;rsquo;s because parted requires (yes, &lt;em&gt;requires&lt;/em&gt;) that a partition be given a name in GPT mode, even though that&amp;rsquo;s absolutely not part of any specification&amp;hellip; So do as you please to christen the first realm of this new digital kingdom!
&lt;/div&gt;
&lt;p&gt;Note however that if you are planning to use UEFI, a second &lt;a href=&#34;https://wiki.archlinux.org/title/EFI_system_partition&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;EFI System Partition&lt;/a&gt; (ESP) is required as well. Here are three more one-liners to create both partitions in one go with a 512 MiB ESP, and the rest for the second partition (&lt;a href=&#34;https://github.com/util-linux/util-linux/issues/267#issue-129814992&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;source&lt;/a&gt; for sfdisk example) :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;printf &#39;,512M,U\n,,&#39; | sfdisk --label gpt /dev/nbd0
sgdisk -n 1:0:+512MiB -t 1:ef00 -n 2:0:0 /dev/nbd0
parted --script --align optimal /dev/nbd0 mklabel gpt mkpart EFI 0% 513MiB mkpart System 513MiB 100% set 1 esp
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;formatting&#34;&gt;&lt;a href=&#34;#formatting&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Formatting&lt;/h3&gt;&lt;p&gt;Before mounting, we need to format our newly created partition(s) with a &lt;a href=&#34;https://wiki.archlinux.org/title/File_systems&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;filesystem&lt;/a&gt;. It&amp;rsquo;s certainly a safe choice to go with the same one as the source system, albeit not strictly required. &lt;a href=&#34;https://wiki.archlinux.org/title/Ext4&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Ext4&lt;/a&gt; example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo mkfs.ext4 /dev/nbd0p1
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;admonition info&#34;&gt;
  &lt;p&gt;If using a raw image file, we first need to use &lt;a href=&#34;https://man.archlinux.org/man/losetup.8.en&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;losetup&lt;/a&gt; to make the partition(s) available to the system:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo losetup --partscan --find --show --nooverlap p2v.img
--&amp;gt; /dev/loop0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;From here on replace &lt;code&gt;/dev/nbd0&lt;/code&gt; with &lt;code&gt;/dev/loop0&lt;/code&gt; (or whatever the command returned).&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;In case of UEFI, the ESP needs to be formatted as FAT (FAT32 &lt;a href=&#34;https://wiki.archlinux.org/title/EFI_system_partition#Format_the_partition&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;recommended&lt;/a&gt;):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo mkfs.fat -F32 /dev/nbd0p1
sudo mkfs.ext4 /dev/nbd0p2
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;mounting&#34;&gt;&lt;a href=&#34;#mounting&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Mounting&lt;/h3&gt;&lt;p&gt;That&amp;rsquo;s it, now we can finally mount our image. For BIOS (single partition):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo mount /dev/nbd0p1 /mnt
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For UEFI (two partitions), replace &lt;code&gt;$ESP&lt;/code&gt; with the desired &lt;a href=&#34;https://wiki.archlinux.org/title/EFI_system_partition#Mount_the_partition&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;mount point&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo mount /dev/nbd0p2 /mnt
sudo mkdir -p /mnt/$ESP
sudo mount /dev/nbd0p1 !$
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That&amp;rsquo;s it for the preparations, we are now ready to transfer the source system content!&lt;/p&gt;
&lt;h2 id=&#34;step-2-transferring-the-data&#34;&gt;&lt;a href=&#34;#step-2-transferring-the-data&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Step 2: Transferring the data&lt;/h2&gt;&lt;p&gt;This part depends on how you realized your &lt;a href=&#34;https://bastientraverse.com/en/posts/2022-02/system-imaging/#system-imaging-the-manual-way&#34;&gt;full system backup&lt;/a&gt; on the source machine. For completeness&amp;rsquo; sake and to create the counterpart to the previous article, I&amp;rsquo;ll show the restoration process of the various tools presented in the linked section.&lt;/p&gt;
&lt;h3 id=&#34;partclone&#34;&gt;&lt;a href=&#34;#partclone&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;partclone&lt;/h3&gt;&lt;p&gt;Word of warning concerning partclone: it&amp;rsquo;s not good at restoring to a device smaller than the source, even if the actual content would fit in. Despite its offering of a &amp;ldquo;Don&amp;rsquo;t check device size and free space&amp;rdquo; (&lt;code&gt;-C, --nocheck&lt;/code&gt;) option, my experience matched the &lt;a href=&#34;https://unix.stackexchange.com/questions/118370/restoring-a-big-partition-to-a-smaller-partition-with-clonezilla&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;web&lt;/a&gt; &lt;a href=&#34;https://superuser.com/questions/332808/force-cloned-hard-disk-image-upon-a-smaller-hard-disk&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;reports&lt;/a&gt; saying that restoration fails with a &lt;code&gt;target seek ERROR:Invalid argument&lt;/code&gt;. Clonezilla FAQ even &lt;a href=&#34;https://drbl.org/faq/fine-print.php?path=./2_System/25_restore_larger_disk_to_smaller_one.faq#25_restore_larger_disk_to_smaller_one.faq&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;warns against this use case&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;However, for completeness&amp;rsquo; sake I&amp;rsquo;ll leave a quick restoration example to illustrate how to restore from a zstd-compressed image:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;umount -R /mnt
zstdcat /path/to/partclone.img.zst | partclone.restore -o /dev/nbd0pY
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Replace the &lt;code&gt;Y&lt;/code&gt; at the end with the appropriate partition number for your use case.&lt;/p&gt;
&lt;div class=&#34;admonition tip&#34;&gt;&lt;p class=&#34;admonition-title&#34;&gt;Tip&lt;/p&gt;
  &lt;em&gt;partclone&lt;/em&gt; offers a &lt;code&gt;--restore_raw_file&lt;/code&gt; option that aims at  &amp;ldquo;creating special raw file for loop device&amp;rdquo;. This image wouldn&amp;rsquo;t have a partition table though so it&amp;rsquo;s not useful for our use case, but it&amp;rsquo;s still good to know it&amp;rsquo;s there 😉️
&lt;/div&gt;
&lt;h3 id=&#34;fsarchiver&#34;&gt;&lt;a href=&#34;#fsarchiver&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;FSArchiver&lt;/h3&gt;&lt;p&gt;I have a sweet spot for FSArchiver due to its versatility and very complete feature set. The only real downside I found to it are its exclusion rule patterns being &lt;a href=&#34;https://github.com/fdupoux/fsarchiver/issues/98&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;less than clear&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Being a file-aware tool instead of block-aware one like partclone, it has absolutely no issues restoring to a destination smaller than the source (it is even one of the suggested workaround in the aforementioned Clonezilla FAQ entry!).&lt;/p&gt;
&lt;p&gt;If you made a backup using its &lt;code&gt;savepart&lt;/code&gt; mode, see the &lt;a href=&#34;https://www.fsarchiver.org/quickstart/#how-to-extract-filesystems-from-an-archive&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;official docs&lt;/a&gt; for nice examples illustrating the different restoration cases.&lt;/p&gt;
&lt;p&gt;On the other hand, if like me you used its &lt;code&gt;savedir&lt;/code&gt; mode so as to have more flexibility, restoring is as simple as:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;fsarchiver --jobs=$(nproc) restdir /path/to/backup.fsa /mnt/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;May &lt;a href=&#34;https://stallman.org/saint.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;St IGNUcius &lt;/a&gt; bless FSarchiver and its author/team! 😇️&lt;/p&gt;
&lt;h3 id=&#34;squashfs&#34;&gt;&lt;a href=&#34;#squashfs&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;SquashFS&lt;/h3&gt;&lt;p&gt;Another very straightforward option:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;unsquashfs -force -dest /mnt/  backup.squashfs
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Bonus points go to SquashFS compared with FSArchiver and tar because we can very simply access the archived content without having to restore/extract it: a simple &lt;code&gt;mount backup.squashfs /path/to/mount/point&lt;/code&gt; suffices to make it browsable (with very good performance) 👍️&lt;/p&gt;
&lt;h3 id=&#34;rsync--tar&#34;&gt;&lt;a href=&#34;#rsync--tar&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Rsync &amp;amp; tar&lt;/h3&gt;&lt;p&gt;&lt;em&gt;rsync&lt;/em&gt; is just about reversing the source and destination in its invocation, and tar about switching &lt;code&gt;-c, --create&lt;/code&gt; with &lt;code&gt;-x, --extract&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rsync -aHAXUUSh --info=progress2 --partial /path/to/backup/dir/* /mnt/
tar -x --zstd -p --acls --xattrs --atime-preserve=system -f /path/to/backup.tar.zst /mnt/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Alright, now that we have transferred the content of our physical system into the VM image, let&amp;rsquo;s move to the final adjustments.&lt;/p&gt;
&lt;h2 id=&#34;step-3-adjusting-the-system-config&#34;&gt;&lt;a href=&#34;#step-3-adjusting-the-system-config&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Step 3: Adjusting the system config&lt;/h2&gt;&lt;p&gt;Now it is time to chroot into our restored environment and make the needed adjustments. This step is very much dependent on your source system configuration and which modifications you wish to implement (if any).&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;arch-chroot /mnt
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;admonition tip&#34;&gt;
  &lt;a href=&#34;https://wiki.archlinux.org/title/Systemd-nspawn&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;systemd-nspawn&lt;/a&gt; can replace &lt;code&gt;arch-chroot&lt;/code&gt; if not using an Arch-based distro.
&lt;/div&gt;
&lt;p&gt;In my case, it equated to removing/commenting out references to the former LVM/LUKS devices in &lt;code&gt;/etc/{fstab,crypttab}&lt;/code&gt; and configuring a single mount:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sed -i &lt;span class=&#34;s1&#34;&gt;&amp;#39;s/^\([^#].*\)/# \1/g&amp;#39;&lt;/span&gt; /etc/crypttab
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sed -i &lt;span class=&#34;s1&#34;&gt;&amp;#39;s/^\([^#].*\)/# \1/g&amp;#39;&lt;/span&gt; /etc/fstab
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;echo&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;/dev/vda1  /  ext4  noatime  0  1&amp;#34;&lt;/span&gt; &amp;gt;&amp;gt; /etc/fstab
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;admonition info&#34;&gt;
  The two &lt;em&gt;sed&lt;/em&gt; invocations comment out &amp;ldquo;active&amp;rdquo; lines while &lt;a href=&#34;https://stackoverflow.com/questions/34982602/how-to-comment-out-only-uncommented-lines-with-sed-and-leave-blank-empty-lines-1&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;leaving blank lines alone&lt;/a&gt;.
&lt;/div&gt;
&lt;p&gt;For GPT replace the last line with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;printf &amp;quot;/dev/vda2  /  ext4  noatime  0  1\n/dev/vda1  /  vfat  defaults  0  2\n&amp;quot; &amp;gt;&amp;gt; /etc/fstab
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Network-wise, I had nothing to do since NetworkManager was already handling automatic network configuration with DHCP.&lt;/p&gt;
&lt;p&gt;I also removed the now unneeded  &lt;code&gt;lvm2&lt;/code&gt;, &lt;code&gt;encrypt&lt;/code&gt;, &lt;code&gt;keyboard&lt;/code&gt; and &lt;code&gt;keymap&lt;/code&gt; &lt;a href=&#34;https://wiki.archlinux.org/title/Mkinitcpio#Common_hooks&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;mkinitcpio hooks&lt;/a&gt; as well as the &lt;code&gt;i915&lt;/code&gt; module from &lt;code&gt;/etc/mkinitcpio.conf&lt;/code&gt; and &lt;a href=&#34;https://wiki.archlinux.org/title/Mkinitcpio#Manual_generation&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;regenerated the initramfs&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Finally, I removed the &lt;code&gt;cryptdevice=&lt;/code&gt; kernel command line parameter from &lt;code&gt;/etc/default/grub&lt;/code&gt;, &lt;a href=&#34;https://wiki.archlinux.org/title/GRUB#Installation&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;installed&lt;/a&gt; GRUB in the image file boot sector and &lt;a href=&#34;https://wiki.archlinux.org/title/GRUB#Generate_the_main_configuration_file&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;regenerated its config&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;grub-install --target&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;i386-pc /dev/nbd0
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sed -i &lt;span class=&#34;s1&#34;&gt;&amp;#39;/cryptdev/s/.*/GRUB_CMDLINE_LINUX_DEFAULT=&amp;#34;quiet&amp;#34;/&amp;#39;&lt;/span&gt; /etc/default/grub
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;grub-mkconfig -o /boot/grub/grub.cfg
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Don&amp;rsquo;t forget to replace references to &lt;code&gt;nbd0&lt;/code&gt; (or &lt;code&gt;loop0&lt;/code&gt;) in &lt;code&gt;/boot/grub/grub.cfg&lt;/code&gt; with whatever disk naming you will use (in my case &lt;code&gt;/dev/vda&lt;/code&gt;):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;sed -i &lt;span class=&#34;s1&#34;&gt;&amp;#39;s/nbd0/vda/g&amp;#39;&lt;/span&gt; /boot/grub/grub.cfg
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then exit the chroot, unmount the image file and remove the &lt;code&gt;nbd&lt;/code&gt; device and module:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;exit
sudo umount -R /mnt/
sudo qemu-nbd -d /dev/nbd0
sudo modprobe -r nbd
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Or loop mount:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;losetup -d /dev/loop0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;(Optionally, &lt;a href=&#34;https://docs.openstack.org/image-guide/convert-images.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;convert&lt;/a&gt; the image to a format suitable to your target hypervisor)&lt;/p&gt;
&lt;p&gt;And &lt;em&gt;voilà&lt;/em&gt;, you are now ready to try out your brand new virtualized system! Hopefully it will boot on the first try, otherwise just &lt;a href=&#34;https://wiki.archlinux.org/title/QEMU#Mounting_a_partition_of_the_guest_on_the_host&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;make the image available&lt;/a&gt; again as before, mount it and chroot in it to troubleshoot the issue.&lt;/p&gt;
&lt;p&gt;Enjoy your nascent hall of past digital abodes! 😉️&lt;/p&gt;
&lt;div class=&#34;admonition tip&#34;&gt;
  &lt;strong&gt;Edit (2024-07-09):&lt;/strong&gt; I&amp;rsquo;ve just stumbled upon &lt;a href=&#34;https://github.com/libguestfs/virt-v2v&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;virt-p2v&lt;/a&gt; from &lt;a href=&#34;http://libguestfs.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;libguestfs&lt;/a&gt;, which is a &amp;ldquo;&lt;em&gt;GUI interface to convert a physical machine to run as virtual machine on KVM&lt;/em&gt;&amp;rdquo;. It is a companion front-end to &lt;a href=&#34;https://github.com/libguestfs/virt-v2v&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;virt-v2v&lt;/a&gt;, and &amp;ldquo;&lt;em&gt;comes as an ISO, CD or PXE image that can be booted on physical machines to virtualize those machines&lt;/em&gt;&amp;rdquo;. Looks like a great alternative to try as well!
&lt;/div&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;At a minimum it should be able to accommodate all the data you&amp;rsquo;re going to transfer from the physical system, plus a little bit of spare space for system maintenance.&amp;#160;&lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>A system imaging tale: LUKS, Clonezilla and friends</title>
      <link>https://bastientraverse.com/en/posts/2022-02/system-imaging/</link>
      <pubDate>Mon, 14 Feb 2022 00:00:00 +0100</pubDate>
      
      <guid>https://bastientraverse.com/en/posts/2022-02/system-imaging/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Today&amp;rsquo;s project:&lt;/strong&gt; make a system image of my previous laptop for archival purposes before refurbishing it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Conditions:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;make a space efficient image, &lt;em&gt;i.e.&lt;/em&gt; not a block-level copy: no need to retain encryption or logical volume setup, only their content matters. However:&lt;/li&gt;
&lt;li&gt;all standard and extended file attributes must be correctly preserved, so that if I ever want to boot this image the system will be in a correct state.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;The plan:&lt;/strong&gt; boot up an Arch ISO, open the encrypted drives, set everything up for &lt;a href=&#34;https://clonezilla.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;clonezilla&lt;/a&gt; &amp;ndash; profit.&lt;/p&gt;
&lt;p&gt;Here is how it actually went.&lt;/p&gt;
&lt;h2 id=&#34;an-unexpected-obstacle-to-boot-ventoy-shenanigans&#34;&gt;&lt;a href=&#34;#an-unexpected-obstacle-to-boot-ventoy-shenanigans&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;An unexpected obstacle to boot: Ventoy shenanigans&lt;/h2&gt;&lt;p&gt;In order to boot into the Arch live environment, I unsheathed my very dear and trusted Sandisk Extreme multiboot USB thumb drive (not the currently sold, lower performing one but the &lt;a href=&#34;https://usb.userbenchmark.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;ever chart-topping&lt;/a&gt; one from about 10 years ago), which had been irreproachably and impeccably fulfilling its duty in the two years since I had discovered &lt;a href=&#34;https://www.ventoy.net/en/index.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Ventoy&lt;/a&gt;, the multiboot solution which surpassed them all and ended my long standing quest to find an easy to use, low-maintenance and low-friction multiboot USB solution. And yes, this was the longest sentence of the entire article 😁&lt;/p&gt;
&lt;p&gt;Just recently I had updated it to the latest version using the provided Linux script, which completed without issue. But as soon as I booted on it, I was faced with an error: &lt;code&gt;Warning! This is not a standard device and is not officially supported&lt;/code&gt;. Um, beg your pardon? It was working fine those past two years, so certainly it was the update which broke something&amp;hellip;&lt;/p&gt;
&lt;p&gt;Searching for this error, I eventually &lt;a href=&#34;https://github.com/ventoy/Ventoy/commit/8bbd5a14a3ca4820266bed6afc1314c3f41e76c3&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;found this &amp;ldquo;kill switch&amp;rdquo;&lt;/a&gt; the dev introduced slightly after I used the software, to try and contain the flood of users with non-standard installs complaining to them when something got wrong.&lt;/p&gt;
&lt;p&gt;I can&amp;rsquo;t really fault them for that, but here is the thing: mine was a pure product of the official tool from back in 2020, with no deviation from the &lt;a href=&#34;https://www.ventoy.net/en/doc_disk_layout.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;prescribed layout/FS&lt;/a&gt; whatsoever. The first partition was starting at the 2048/1 MB boundary and formatted with the default exFAT, the second partition was 65536 sector large, the drive had an MBR partition table and all and all&amp;hellip;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# fdisk -l /dev/sda
Disk /dev/sda: 59.63 GiB, 64023257088 bytes, 125045424 sectors
Disk model: Extreme  
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd1a119ab

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sda1  *         2048 124979887 124977840 59.6G  7 HPFS/NTFS/exFAT
/dev/sda2       124979888 125045423     65536   32M ef EFI (FAT-12/16/32)&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The official command line tool didn&amp;rsquo;t complain either while upgrading or when run manually:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# ventoy -l /dev/sda

**********************************************
      Ventoy: 1.0.65  x86_64
      longpanda admin@ventoy.net
      https://www.ventoy.net
**********************************************

Ventoy Version in Disk: 1.0.65
Disk Partition Style  : MBR
Secure Boot Support   : NO
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Indeed but nope, I got axed by the kill switch all the same. Fuck artificial restrictions and &lt;a href=&#34;https://www.gnu.org/philosophy/can-you-trust.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;treacherous computing&lt;/a&gt;. And I am burned by a free software project at that&amp;hellip; What to expect from this world.&lt;/p&gt;
&lt;p&gt;Anyhoo, after transfering out my 24 GB of GNU/Linux ISOs (God bless USB 3.0 &amp;amp; &lt;em&gt;quality&lt;/em&gt; flash memory speeds), I forced a reinstall with the &lt;code&gt;-I&lt;/code&gt; switch:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# ventoy -I /dev/sda

**********************************************
      Ventoy: 1.0.65  x86_64
      longpanda admin@ventoy.net
      https://www.ventoy.net
**********************************************

Disk : /dev/sda
Size : 59 GB
Style: MBR


Attention:
You will install Ventoy to /dev/sda.
All the data on the disk /dev/sda will be lost!!!

Continue? (y/n) y

All the data on the disk /dev/sda will be lost!!!
Double-check. Continue? (y/n) y

Create partitions on /dev/sda by parted in MBR style ...
Done
Wait for partitions ...
partition exist OK
create efi fat fs /dev/sda2 ...
mkfs.fat 4.2 (2021-01-31)
success
Wait for partitions ...
/dev/sda1 exist OK
/dev/sda2 exist OK
partition exist OK
Format partition 1 /dev/sda1 ...
mkexfatfs 1.3.0
Creating... done.
Flushing... done.
File system created successfully.
mkexfatfs success
writing data to disk ...
sync data ...
esp partition processing ...
Open ventoy efi file 0x610ac0
ventoy x64 efi file size 1757184 ...
Open bootx64 efi file 0x610ac0
Open ventoy ia32 efi file 0x610f10
ventoy efi file size 1183744 ...
Open bootia32 efi file 0x610ac0

Install Ventoy to /dev/sda successfully finished.

sudo ventoy -I /dev/sda  5,11s user 2,58s system 19% cpu 39,813 total
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After transferring my files back and rebooting on the flash drive, everything was back in order and I was ready to rock 🤟&lt;/p&gt;
&lt;h2 id=&#34;optional-step-setting-up-a-comfortable-environment&#34;&gt;&lt;a href=&#34;#optional-step-setting-up-a-comfortable-environment&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Optional step: setting up a comfortable environment&lt;/h2&gt;&lt;p&gt;Being console-based, the archiso environment is somewhat austere. So the first thing I usually do is to set up SSH access so as to connect from my main machine:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# set french keymap&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# the &amp;#34;-latin9&amp;#34; part is only needed if using e.g. accents&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;loadkeys fr-latin9
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# directly connect to a known Wifi SSID&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;iwctl station wlan0 connect &amp;lt;SSID&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# Enable NTP to have accurate time&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;timedatectl set-timezone &amp;lt;Area/City&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;timedatectl set-ntp &lt;span class=&#34;nb&#34;&gt;true&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# set root passhrase to enable SSH connection&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;passwd
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# start SSH service&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;systemctl start sshd
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# get IP address&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;iwctl station wlan0 show &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; grep IP &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; awk &lt;span class=&#34;s1&#34;&gt;&amp;#39;{print $3}&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# or without iwd:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;ip a &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; grep wlan &lt;span class=&#34;p&#34;&gt;|&lt;/span&gt; awk &lt;span class=&#34;s1&#34;&gt;&amp;#39;FNR == 2 {print substr($2, 1, length($2)-3)}&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Finally, connect to the live environment via SSH:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;ssh -o &lt;span class=&#34;nv&#34;&gt;PreferredAuthentications&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;password &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -o &lt;span class=&#34;nv&#34;&gt;PubkeyAuthentication&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;no &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -o &lt;span class=&#34;nv&#34;&gt;UserKnownHostsFile&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;/dev/null &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    root@&amp;lt;other-machine-IP&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;admonition tip&#34;&gt;
  👉️ The options used allow not to be affected by the local SSH configuration (SSH keys&amp;hellip;), as well as well not polluting the local KnownHosts file with this one-time connection.
&lt;/div&gt;
&lt;p&gt;That&amp;rsquo;s it, now we can resume with the common procedure!&lt;/p&gt;
&lt;h2 id=&#34;clonezilla-and-lukslvm&#34;&gt;&lt;a href=&#34;#clonezilla-and-lukslvm&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Clonezilla and LUKS/LVM&lt;/h2&gt;&lt;p&gt;In order to &lt;em&gt;efficiently&lt;/em&gt; image the system, we first need to open any LUKS container and make sure all the LVs are displayed correctly:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cryptsetup open --allow-discards /dev/sdb2 os
lvs
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then we create the &lt;code&gt;/home/partimag&lt;/code&gt; directory (hardcoded backup destination in Clonezilla) and mount our drive on it:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;mkdir /home/partimag
mount -o noatime /dev/sdc1 !$
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;admonition info&#34;&gt;&lt;p class=&#34;admonition-title&#34;&gt;Note&lt;/p&gt;
  &lt;p&gt;When booting the archiso, I selected the &amp;ldquo;Copy to RAM&amp;rdquo; option so as to free up the drive and reuse it as backup destination.&lt;/p&gt;
&lt;p&gt;However, in order to do that I first needed to get rid of a lingering &lt;code&gt;/dev/mapper/ventoy&lt;/code&gt;  mapping on its first partition, which made &lt;code&gt;eject&lt;/code&gt;/&lt;code&gt;udisksctl&lt;/code&gt; throw errors despite the fact that it wasn&amp;rsquo;t mounted and &lt;code&gt;lsof | grep -e ventoy -e sdb&lt;/code&gt; didn&amp;rsquo;t return anything. I didn&amp;rsquo;t want to pull it out on the off chance it&amp;rsquo;d corrupt something&amp;hellip;&lt;/p&gt;
&lt;p&gt;I wrote a &lt;a href=&#34;https://bastientraverse.com/en/posts/2022-02/cli-eject/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;separate post&lt;/a&gt; which goes into the details, but the gist is a simple &lt;code&gt;dmsetup remove ventoy&lt;/code&gt; took care of the mapping, and then I was able to normally mount the drive.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;And now it is &lt;em&gt;&lt;strong&gt;on!&lt;/strong&gt;&lt;/em&gt; Launch &lt;code&gt;clonezilla&lt;/code&gt; from the command line and follow the on-screen instructions depending on your needs. Some personal recommendations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;use expert mode&lt;/li&gt;
&lt;li&gt;avoid the 4G backup splitting by entering a large number when prompted (like 100000)&lt;/li&gt;
&lt;li&gt;select &amp;ldquo;parallel zstd&amp;rdquo; (&lt;code&gt;-z9p&lt;/code&gt;) as the compression algorithm&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Or if you feel like keeping it CLI-only&amp;hellip;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;/usr/bin/ocs-sr &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --use-partclone &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --confirm &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --clone-hidden-data &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --zstdmt-compress
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    --image-size &lt;span class=&#34;m&#34;&gt;1000000&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --fsck-src-part &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --skip-enc-ocs-img &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --postaction choose &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    saveparts &amp;lt;backup-name&amp;gt; sdb1 sdb2
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is the long form equivalent of the&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/usr/bin/ocs-sr -q2 -c -j2 -z9p -i 1000000 -fsck -senc -p choose saveparts &amp;lt;backup-name&amp;gt; sdb1 sdb
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;that got copied in a file under &lt;code&gt;/tmp&lt;/code&gt; after validating my options in the TUI.&lt;/p&gt;
&lt;p&gt;Then we just sit back and relax&amp;hellip; Wait, what? &lt;code&gt;dd mode&lt;/code&gt;? Why aren&amp;rsquo;t my OS logical volumes backed up by the regular free space-aware &lt;code&gt;partclone&lt;/code&gt; mode? I explicitly decrypted the containers for that purpose, and saw the LVs being listed during the preparation screens! Although it&amp;rsquo;s true I could only select whole partitions to be backed up and not specific logical volumes, and saw a line flash by saying something like &lt;code&gt;Shutting down the Volume manager&lt;/code&gt;&amp;hellip; Oh come on.&lt;/p&gt;
&lt;p&gt;One &lt;kbd&gt;Ctrl&lt;/kbd&gt;+&lt;kbd&gt;c&lt;/kbd&gt; later the backup of &lt;code&gt;/dev/sdb2&lt;/code&gt; was cancelled, but the unencrypted &lt;code&gt;/dev/sdb1&lt;/code&gt; with the &lt;code&gt;arch&lt;/code&gt; LV (the only one in the &lt;code&gt;boot&lt;/code&gt; VG) proceeded without issue. What the heck clonezilla?&lt;/p&gt;
&lt;p&gt;Hum alright, according to &lt;a href=&#34;https://sourceforge.net/p/clonezilla/discussion/Help/thread/770897b4/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;this 2014 thread&lt;/a&gt; with the developer&amp;rsquo;s input, it seems this isn&amp;rsquo;t as straightforward as it looks. And it happened even &lt;a href=&#34;https://sourceforge.net/p/clonezilla/mailman/clonezilla-live/thread/MY6SeQk--3-2%40tuta.io/#msg37260650&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;much more recently&lt;/a&gt; to another user (although according to the dev&amp;rsquo;s answer it shouldn&amp;rsquo;t be the case), so anyway&amp;hellip; Time for some manual &lt;a href=&#34;https://partclone.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;partclone&lt;/a&gt; fun I guess!&lt;/p&gt;
&lt;h2 id=&#34;system-imaging-the-manual-way&#34;&gt;&lt;a href=&#34;#system-imaging-the-manual-way&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;System imaging, the manual way&lt;/h2&gt;&lt;p&gt;Full disclosure: I had already stumbled upon the &amp;ldquo;&lt;em&gt;manual partclone required&lt;/em&gt;&amp;rdquo; caveat when trying to efficiently backup LUKS-encrypted systems with Clonezilla, so I wasn&amp;rsquo;t really at a loss. All in all it&amp;rsquo;s pretty simple, you just have to use &lt;em&gt;partclone&lt;/em&gt; like so:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;partclone.$fstype --clone --source ... --output ...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Wich gave in my case:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;partclone.ext4 --clone --source /dev/mapper/arch-root --output &amp;lt;backup path&amp;gt;/$(date -I)-old-laptop-archroot.ext4-ptcl.img
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;admonition tip&#34;&gt;&lt;p class=&#34;admonition-title&#34;&gt;Tip&lt;/p&gt;
  If you want to have the same nice ncurses-based UI as Clonezilla does, add the &lt;code&gt;-N/--ncurses&lt;/code&gt; option (&lt;a href=&#34;https://linuxconfig.org/how-to-use-partclone-to-create-a-smart-partition-backup&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;example&lt;/a&gt;).
&lt;/div&gt;
&lt;p&gt;Though if we really want to mimick Clonezilla and have space-efficient backups, we gotta add compression to the mix!&lt;/p&gt;
&lt;h3 id=&#34;compressing-partclone-images-with-zstd&#34;&gt;&lt;a href=&#34;#compressing-partclone-images-with-zstd&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Compressing partclone images with zstd&lt;/h3&gt;&lt;p&gt;Being a devout &lt;a href=&#34;https://facebook.github.io/zstd/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Zstandard&lt;/a&gt; Zealot© (&lt;a href=&#34;https://gregoryszorc.com/blog/2017/03/07/better-compression-with-zstandard/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;this post&lt;/a&gt; summarizes well my feelings &amp;ndash; no affiliation with the author), here is how to interface it with partclone for a nicely multi-threaded compression:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;partclone.ext4 --clone --source /dev/mapper/arch-root | zstdmt -o &amp;lt;backup path&amp;gt;/$(date -I)-old-laptop-archroot.ext4-ptcl-img.zst
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;admonition info&#34;&gt;&lt;p class=&#34;admonition-title&#34;&gt;Info&lt;/p&gt;
  From &lt;a href=&#34;https://man.archlinux.org/man/zstd.1#SYNOPSIS&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;zstd man page&lt;/a&gt;: &lt;code&gt;zstdmt&lt;/code&gt; is equivalent to &lt;code&gt;zstd -T0&lt;/code&gt;, enabling auto-adjusted multi-threading.
&lt;/div&gt;
&lt;p&gt;If you are like me and have several LVs to clone and their names follow a pattern, you can use a for loop to optimize things a bit:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;for i in arch-{root,home,opt,var} boot-arch; do partclone.ext4 --clone --source /dev/mapper/&amp;quot;${i}&amp;quot; | zstdmt -o &amp;lt;backup path&amp;gt;/$(date -I)-&amp;quot;${i}&amp;quot;.ext4-ptcl-img.zst; done
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;Et voilà&lt;/em&gt;, space-efficient compressed images of your decrypted LVs!&lt;/p&gt;
&lt;div class=&#34;admonition tip&#34;&gt;&lt;p class=&#34;admonition-title&#34;&gt;Tip&lt;/p&gt;
  Someone made a &lt;a href=&#34;https://gist.github.com/andyrbell/4a339c0d8a3bc9465743a6b876671dcb&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;gist&lt;/a&gt; using somewhat older commands and touching upon restoration etc&amp;hellip; Give it a look if you want to review the process!
&lt;/div&gt;
&lt;h2 id=&#34;extra-comparing-the-process-with-different-tools&#34;&gt;&lt;a href=&#34;#extra-comparing-the-process-with-different-tools&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Extra: comparing the process with different tools&lt;/h2&gt;&lt;p&gt;A very precious thing in this world is diversity. Of people, ideas, food&amp;hellip; And backup tools. Here is a rundown of the same task undertaken with four of them:&lt;/p&gt;
&lt;h3 id=&#34;fsarchiver&#34;&gt;&lt;a href=&#34;#fsarchiver&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;FSArchiver&lt;/h3&gt;&lt;p&gt;The first time I realized I couldn&amp;rsquo;t use Clonezilla to properly back up my decrypted LVs, I stumbled upon a great alternative to partclone: &lt;a href=&#34;https://www.fsarchiver.org/compression/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;FSArchiver&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The main reason for using it over the former? FSArchiver:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;directly integrates &lt;a href=&#34;http://www.fsarchiver.org/internal-multithreading/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;multi-threaded&lt;/a&gt; compression with zstd (and &lt;a href=&#34;https://www.fsarchiver.org/compression/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;recommends it over any others&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;allows to specify multiple filesystems to be archived at once&lt;/li&gt;
&lt;li&gt;also works with directories (creating a compressed and checksummed tarball of sorts)&lt;/li&gt;
&lt;li&gt;allows to restore to a different filesystem and creating it in one go&lt;/li&gt;
&lt;li&gt;allows to restore to a smaller partition by default, whereas partclone needs the &lt;code&gt;-C&lt;/code&gt; option (and often just ends on a seek error)&lt;/li&gt;
&lt;li&gt;accepts exclusion patterns to filter what&amp;rsquo;s archived/restored (&lt;a href=&#34;https://github.com/fdupoux/fsarchiver/issues/98#issuecomment-1050415780&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;the syntax is a bit tricky though&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;offers to optionally encrypt data in the archive&lt;/li&gt;
&lt;li&gt;and is generally really careful with data integrity&amp;hellip; If that wasn&amp;rsquo;t already reason enough 😉&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Its multi-threaded compression-ready invocation goes something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;fsarchiver --zstd=3 --jobs=$(nproc) savefs &amp;lt;backup path&amp;gt;/&amp;lt;archive-name&amp;gt;.fsa &amp;lt;list of devices to backup&amp;gt; --exclude=&amp;lt;exclude pattern&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--zstd=3&lt;/code&gt; stands for zstd-compression at level 3&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--jobs=$(nproc)&lt;/code&gt; works exactly like the eponymous &lt;code&gt;make&lt;/code&gt; switch, enabling as many threads as there are logical cores on your system.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So for example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;fsarchiver -Z3 -j$(nproc) -v savefs &amp;lt;backup-path&amp;gt;/old-laptop.fsa /dev/mapper/arch-{root,home,opt,var} /dev/mapper/boot-arch --exclude=&amp;quot;lost+found&amp;quot; --exclude=&amp;quot;/var/cache/pacman/pkg/*&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;-v/--verbose&lt;/code&gt; option is useful to get a progress report, however it will list every file being archived and as such likely blow away your terminal history.&lt;/p&gt;
&lt;div class=&#34;admonition info&#34;&gt;
  BTW, &lt;a href=&#34;https://sourceforge.net/p/clonezilla/discussion/Open_discussion/thread/295770be/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;here is why&lt;/a&gt; clonezilla defaults to &lt;em&gt;partclone&lt;/em&gt; instead of &lt;em&gt;fsarchiver&lt;/em&gt; in the words of its author. Tldr: partclone supports pipes/stdin/stdout which are needed for other Clonezilla features, while fsarchiver doesn&amp;rsquo;t. Tough life.
&lt;/div&gt;
&lt;p&gt;Note however that FSArchiver (just like partclone) doesn&amp;rsquo;t deal with recreating a partition table on the destination, or any other form of partitioning/preparing the drive such as LUKS/LVM: you gotta do all that manually up to the point where you are ready to restore &lt;em&gt;filsystems&lt;/em&gt; (that is to say, fsarchiver isn&amp;rsquo;t a &lt;em&gt;disk cloning&lt;/em&gt; solution).&lt;/p&gt;
&lt;p&gt;Also, you cannot merge the content of separate partitions created this way into one destination (&lt;em&gt;e.g.&lt;/em&gt; if you want to consolidate separate LVs into one FS): they will overwrite each other. For that you&amp;rsquo;d rather use the &lt;code&gt;savedir/restdir&lt;/code&gt; mode, which is akin to a tarball on steroids.&lt;/p&gt;
&lt;h3 id=&#34;squashfs&#34;&gt;&lt;a href=&#34;#squashfs&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Squashfs&lt;/h3&gt;&lt;p&gt;I discovered this method by stumbling upon this gem on the Arch wiki, &amp;ldquo;&lt;a href=&#34;https://wiki.archlinux.org/title/Full_system_backup_with_SquashFS&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Full system backup with SquashFS&lt;/a&gt;&amp;rdquo;, and although the article is in dire need of a proper rewrite (which I&amp;rsquo;ve added to my todo list) I really wanted to give it a try.&lt;/p&gt;
&lt;p&gt;In the words of &lt;a href=&#34;https://tldp.org/HOWTO/SquashFS-HOWTO/whatis.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;TLDP&lt;/a&gt;, &lt;a href=&#34;https://en.wikipedia.org/wiki/SquashFS&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;SquashFS&lt;/a&gt; is&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;ldquo;a read-only file system that lets you compress whole file systems or single directories, write them to other devices/partitions or to ordinary files, and then mount them directly (if a device) or using a loopback device (if it is a file). [&amp;hellip;] For archiving purposes, SquashFS gives you a lot more flexibility and performance speed than a tarball archive.&amp;rdquo;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Its selling points to me are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;random access &amp;amp; transparent decompression: no need to decompress and extract the entire image to browse its content (this is huge, especially when talking about gigabyte-sized images&amp;hellip;)&lt;/li&gt;
&lt;li&gt;file-level deduplication&lt;/li&gt;
&lt;li&gt;exclusion patterns&lt;/li&gt;
&lt;li&gt;zstd support 😊&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;However be aware that it &lt;a href=&#34;https://www.kernel.org/doc/html/latest/filesystems/squashfs.html#todo-list&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;doesn&amp;rsquo;t support ACLs&lt;/a&gt;, so if you rely on them you should look somewhere else.&lt;/p&gt;
&lt;p&gt;After quickly perusing its &lt;a href=&#34;https://www.mankier.com/1/mksquashfs&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;manpage&lt;/a&gt; I gave it a go:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;mount -o ro /dev/mapper/arch-root /mnt
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;mount -o ro /dev/mapper/boot-arch /mnt/boot
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;for&lt;/span&gt; i in home opt var&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;do&lt;/span&gt; mount -o ro /dev/mapper/arch-&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;${&lt;/span&gt;&lt;span class=&#34;nv&#34;&gt;i&lt;/span&gt;&lt;span class=&#34;si&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt; /mnt/&lt;span class=&#34;nv&#34;&gt;$i&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;cd&lt;/span&gt; /mnt
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;mksquashfs ./ &amp;lt;backup-path&amp;gt;/old-laptop.sqsh &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -comp zstd &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -no-exports &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -progress &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -mem 6G &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -not-reproducible &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -e var/cache/pacman/pkg
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Results:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Squashfs 4.0 filesystem, zstd compressed, data block size 131072
	compressed data, compressed metadata, compressed fragments,
	compressed xattrs, compressed ids
	duplicates are removed
Filesystem size 3912057.66 Kbytes (3820.37 Mbytes)
	35.64% of uncompressed filesystem size (10975717.90 Kbytes)
Inode table size 2886293 bytes (2818.65 Kbytes)
	24.42% of uncompressed inode table size (11819496 bytes)
Directory table size 3606490 bytes (3521.96 Kbytes)
	36.39% of uncompressed directory table size (9910813 bytes)
Xattr table size 621 bytes (0.61 Kbytes)
	28.98% of uncompressed xattr table size (2143 bytes)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To put things in perspective:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;root@archiso ~ # du -sh /mnt
16G	/mnt
root@archiso ~ # du -sh /mnt/var/cache/pacman/pkg
4.5G	/mnt/var/cache/pacman/pkg
root@archiso ~ # du -h &amp;lt;backup-path&amp;gt;/old-laptop.sqsh
3.8G	&amp;lt;backup-path&amp;gt;/old-laptop.sqsh
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So it went from 16-4.5=11.5 GiB to 3.8&amp;hellip; Nice!&lt;/p&gt;
&lt;p&gt;It produced a slightly smaller archive than both partclone and fsarchiver (even when accounting for the non-excluded pacman cache), but it took 11.5 minutes. After testing, &lt;code&gt;fsarchiver savedir&lt;/code&gt; took 3min08s and produced a 4.2 GiB image (with &lt;code&gt;--exclude=&#39;*.pkg.tar.zst&#39;&lt;/code&gt;), but then fsarchiver doesn&amp;rsquo;t produce browsable archives and doesn&amp;rsquo;t do any deduplication 😊&lt;/p&gt;
&lt;h3 id=&#34;rsync&#34;&gt;&lt;a href=&#34;#rsync&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Rsync&lt;/h3&gt;&lt;p&gt;One step more remote from system imaging, the ever powerful Swiss-army knife of file transfer can evidently also be used to create &lt;a href=&#34;https://wiki.archlinux.org/title/Rsync#Full_system_backup&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;full system backups&lt;/a&gt;. Here is my personal take on it:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;rsync &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --archive &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --hard-links &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --acls &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --xattrs &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --atimes &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --open-noatime &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --sparse &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --human-readable &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --info&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;progress2 &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --partial &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --exclude&lt;span class=&#34;o&#34;&gt;={&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;var/cache/pacman/pkg/*&amp;#34;&lt;/span&gt;,&lt;span class=&#34;s2&#34;&gt;&amp;#34;*/lost+found&amp;#34;&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;}&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    /mnt/* /path/to/backup/dir
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Or as a one-liner:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rsync -aHAXUUSh --info=progress2 --partial --exclude={&amp;quot;var/cache/pacman/pkg/*&amp;quot;,&amp;quot;*/lost+found&amp;quot;} /mnt/* /path/to/backup/dir
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;See its &lt;a href=&#34;https://man.archlinux.org/man/extra/rsync/rsync.1.en&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;man page&lt;/a&gt; for details on the options used. Note that the repeated &lt;code&gt;-U&lt;/code&gt; is not a mistake but a shortcut to enable both &lt;code&gt;--atimes&lt;/code&gt; and &lt;code&gt;--open-noatime&lt;/code&gt; 😉&lt;/p&gt;
&lt;p&gt;However, while doing so I realized rsync wasn&amp;rsquo;t exactly the best solution when the destination filesystem is {ex,}FAT&amp;hellip; Timestamps and permissions/ACLs/xattr won&amp;rsquo;t carry over correctly&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt; 😒  This is what got me for the very first time interested in using&amp;hellip;&lt;/p&gt;
&lt;h3 id=&#34;tar&#34;&gt;&lt;a href=&#34;#tar&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Tar&lt;/h3&gt;&lt;p&gt;O venerable Lord of computerized backups! Thy name is reminiscent of the glorious days of yore, when backups were mere &lt;em&gt;&lt;strong&gt;t&lt;/strong&gt;ape &lt;strong&gt;ar&lt;/strong&gt;chives&lt;/em&gt;&amp;hellip;&lt;/p&gt;
&lt;p&gt;Okay, but how does it fare in 2022 for complete system backup with high fidelity? After delving into its &lt;a href=&#34;https://man.archlinux.org/man/core/tar/tar.1.en&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;manpage&lt;/a&gt; this is what I came up with:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nb&#34;&gt;cd&lt;/span&gt; /mnt
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;tar --create &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --preserve-permissions &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --acls &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --xattrs &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --atime-preserve&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;system &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    --exclude&lt;span class=&#34;o&#34;&gt;={&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;var/cache/pacman/pkg/*&amp;#34;&lt;/span&gt;,&lt;span class=&#34;s2&#34;&gt;&amp;#34;*lost+found&amp;#34;&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;}&lt;/span&gt; &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -I zstdmt &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    -f /path/to/backup/dir/&amp;lt;backup-name&amp;gt;.tar.zst &lt;span class=&#34;se&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;se&#34;&gt;&lt;/span&gt;    *
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;tar: /var/run/nscd/socket: socket ignored
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;...
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# repeat dozens of times&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Hmmm okay, apart from socket files which apparently &lt;a href=&#34;https://comp.os.linux.redhat.narkive.com/z7CkxLXY/excluding-sockets-in-a-tar-backup&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;clearly&lt;/a&gt; &lt;a href=&#34;https://superuser.com/a/705649&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;don&amp;rsquo;t matter&lt;/a&gt;, what about the completeness of the backup? Sections &lt;a href=&#34;https://www.gnu.org/software/tar/manual/tar.html#verify&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;verify&lt;/a&gt; and &lt;a href=&#34;https://www.gnu.org/software/tar/manual/tar.html#compare&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;compare&lt;/a&gt; from tar manual cover this question. A few pitfalls to be aware of however:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--verify&lt;/code&gt; (only for archive creation) &lt;a href=&#34;https://unix.stackexchange.com/questions/618991/how-to-fix-tar-cannot-verify-compressed-archives-error&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;doesn&amp;rsquo;t work with compressed archives&lt;/a&gt;; if you don&amp;rsquo;t mind you can first create and verify an uncompressed archive, then compress it in a second step&amp;hellip;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--compare&lt;/code&gt; &amp;ldquo;&lt;em&gt;ignores files in the file system that do not have corresponding members in the archive&lt;/em&gt;&amp;rdquo;, so if something was left over during the backup, no errors will be reported.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you have the space and will for it, you could also just extract the archive and &lt;code&gt;diff --recursive&lt;/code&gt; it against the source, but all in all I feel this is an aspect where the original (and still current) purpose of tar as a &lt;em&gt;tape specific archiving tool&lt;/em&gt;, makes itself felt.&lt;/p&gt;
&lt;p&gt;From my superficial testing everything seemed mostly alright, but I can&amp;rsquo;t shake the feelings that tar isn&amp;rsquo;t making as complete a clone as fsarchiver or rsync (see its &lt;a href=&#34;https://en.wikipedia.org/wiki/Tar_%28computing%29#Limitations&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;limitations&lt;/a&gt; too). But that&amp;rsquo;s probably because my beard isn&amp;rsquo;t  &lt;a href=&#34;https://www.urbandictionary.com/define.php?term=grey%20beard&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;grey enough&lt;/a&gt; I guess&amp;hellip; 😁&lt;/p&gt;
&lt;h2 id=&#34;wrap-up&#34;&gt;&lt;a href=&#34;#wrap-up&#34; class=&#34;headerlink anchor&#34;&gt;&lt;i class=&#34;iconfont icon-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;Wrap up&lt;/h2&gt;&lt;p&gt;In conclusion, if you are in a situation where Clonezilla doesn&amp;rsquo;t work for you (most notably when using LUKS), my recommendation would be to turn to either &lt;strong&gt;FSArchiver&lt;/strong&gt;, &lt;strong&gt;partclone&lt;/strong&gt; or &lt;strong&gt;SquashFS&lt;/strong&gt;. They seem to provide the most complete and reliable feature-set of the lot for imaging systems in a correct and efficient way. Rsync and tar being more general purpose tools, they require more options not to leave something out or otherwise shoot yourself in the foot.&lt;/p&gt;
&lt;p&gt;Also, while laboring over this article I realized that while it was all fine and dandy to have a static archive of my old system, the next step was to make an &lt;em&gt;interactive&lt;/em&gt; image of it that I could boot on whenever I want to see which GTK theme I used, or otherwise take a nostalgic whiff and relapse in my former computing abode&amp;hellip;&lt;/p&gt;
&lt;p&gt;This reminded me of the &lt;a href=&#34;https://wiki.archlinux.org/title/Moving_an_existing_install_into_%28or_out_of%29_a_virtual_machine&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Moving an existing install into a virtual machine&lt;/a&gt; article, and I have an entire article coming up with the fruits of this endeavour: creating a VM image from the backups made here, testing in the process the oh-so-important restoration side of all the different tools used here (which taught me that an un-restored backup is no backup at all), making the required adjustments to be able to boot from it&amp;hellip; Stay stuned for the second part! [edit: &lt;a href=&#34;https://bastientraverse.com/en/posts/2022-04/physical-to-virtual/&#34;&gt;there it goes&lt;/a&gt;]&lt;/p&gt;
&lt;p&gt;Thanks for reading and happy imaging 🙏&lt;/p&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;One workaround is to use a &lt;a href=&#34;https://en.wikipedia.org/wiki/Loop_device&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;loop device&lt;/a&gt; file, &lt;em&gt;i.e.&lt;/em&gt; create a file sufficiently large to hold your backup, partition it, activate it via &lt;code&gt;losetup&lt;/code&gt;, then finally format it with a more amenable filesystem and  mount it as the backup destination (&lt;a href=&#34;https://wiki.archlinux.org/title/Moving_an_existing_install_into_%28or_out_of%29_a_virtual_machine#Create_the_container&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;example&lt;/a&gt;).&amp;#160;&lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
    </item>
    
  </channel>
</rss>
