Is there a way to backup/restore qube metadata by itself? That is, make a backup of a qube but without the contents of its volumes? I’m looking for any method at all, whether it’s a tool, or series of system commands, or some sort of API calls.
Nothing native. You can look in /usr/lib/python3.13/site-packages/qubesadmin
and dig at backup/core3.py and associated files, or roll your own from
prefs,features,tags,firewall etc
I never presume to speak for the Qubes team.
When I comment in the Forum I speak for myself.
I’ve also often wanted to have some kind of qvm-backup(-restore) --metadata-only mode.
Backing up the metadata is easy enough to do manually, by making a copy of /var/lib/qubes/qubes.xml and /var/lib/qubes/*/*/firewall.xml. That’s basically what qvm-backup does.
But how to restore qubes.xml… Not so easy if only some VMs should be restored, or if restoring to a newer Qubes OS release.
That’s why it’s easier to use the native tools. Then you can create a new
qube and push the relevant features on to it. (Unless you want something
different from this?)
IMO it’s better not to try and reimplement the backup/restore logic at all, because especially the restore side (dealing with dependencies etc.) is super tricky.
If someone wants to explore this, the logic that handles non-save_on_stop volumes looks promising. Maybe extending it to all volumes if a global metadata-only flag is active would be enough.