Wyng: how to run wyng monitor when backing up with wyng-util-qubes?

From the wyng-util-qubes docs:

When a system uses the Qubes OS default of Thin LVM storage there is an avoidable cause of pool metadata space exhaustion, a condition that can cause your system storage to go offline or become corrupted. Since Wyng adds its own snapshots on top of Qubes snapshots, using Wyng adds a bit more demand for Thin LVM metadata. The answer to this is almost always to increase the qubes-dom0/vm-pool metadata size with sudo lvextend --poolmetadatasize. Qubes has recently addressed this by increasing the metadata size somewhat during installation, however based on observations it may be optimal to increase this amount by a further 50-100%. Periodically running wyng monitor can also reduce metadata use.

wyng-util-qubes does not accept ā€œmonitorā€
ā€œwyng monitor --allā€ fails with ā€œmissing dest specificationā€
adding the dest used with wyng-util-qubes yields
"Error, Local path not found: (None) None"
followed by
"Error on volumes: [all my backed up volumes]"

Can someone please explain how to do regular cleanup? May I cc @tasket ?

@Ryzen9950x

Correct, wyng-util-qubes doesn’t yet support monitor. Running wyng monitor directly is fine, but you have to specify where the local storage is and also the volumes names (or use --all).

Example: sudo wyng monitor vm-personal-private --dest=\<URL\> --local=qubes_dom0/vm-pool

Its easy to forget that Wyng needs --local specified for many commands since wyng-util-qubes queries Qubes and supplies it automatically.

1 Like

Thank you very much. This worked. I’ll lob it in my crontab. What is the recommended way to backup dom0 with Wyng, I see there’s code which checks and skips it.

Also, thank you for

72 volumes, 1318912——>19117 MB in 334.7 seconds.

I think according to Qubes there is no way to comprehensively backup dom0, but on occasion when something has been reconfigured in dom0 there are two easy options that I’ve used:

  1. If dom0 is on thin LVM, do a direct wyng send --local=qubes_dom0/root root and Wyng will take a snapshot automatically before backing up. (Or manually take a snapshot of the root LV using a sensible name like ā€˜root-bak’ and back that up; its a matter of personal taste.) Yes, the snapshot will be ā€˜hot’, but in this context with the filesystem and LVM running under the same kernel, LVM should automatically send the appropriate signal to the fs to ā€˜settle’ it momentarily before the snapshot. I’ve restored perhaps 5 or 6 dom0 roots this way without issues.
  2. For non-LVM dom0 root I’ve used the following script to backup /etc and /home to a dedicated VM hundreds of times:
#!/bin/sh
set -e

do_dom0_root() {
  sudo mkdir -p /etc/backup-misc
  sudo cp -u /var/lib/qubes/qubes.xml /etc/backup-misc

  sudo tar -cf - /etc /home | qvm-run -u root -p root-backup \
      'mkdir -p /home/user/backup && cd /home/user/backup && tar --warning=no-ignore-newer --keep-newer-files --exclude=*/.cache/>
  qvm-run -u root -p root-backup \
      "find /home/user/backup -printf '%P\n' |grep -v '^$' |sort >/tmp/l-find"
  qvm-run -p root-backup \
      "sed 's/\/$//' /tmp/tar_index |sort |comm -23 /tmp/l-find - >l-delete"
  qvm-run -u root -p root-backup \
      'cd /home/user/backup && cat ../l-delete | xargs -r rm -rf'

  qvm-shutdown root-backup
}

if [ "$1" = "dom0" ]; then
  do_dom0_root
  shift
fi

sudo ~/usr/local/bin/wyng-util-qubes backup root-backup $@

The result is a copy of /etc and /home (or whatever you put on the first tar line) where only changed files are updated in the vm, and any files that no longer exist in dom0 are also removed from the vm (although they will continue to exist in past Wyng backup sessions until you prune them out).

[Edit:] You could do no. 2 differently (more secure?) by just creating your own disk image in dom0 and mounting that directly, so no guest VM is involved. Without the guest VM, you would have to run wyng send directly since the util won’t see it.

2 Likes

This will work, thank you. Experimenting with the --unattended flag, but haven’t figured out how to load the encryption password from a file so I can run my wyng backups using cron.