Hi,
On 11/25/18 11:31 PM, Stumpy wrote:
> I was wanting to back up some of my more important appvms, like vault,
> on a regular basis. I am lazy so was thinking that cron might be an
> option? Its been awhile since I used cron but I assume I could make a
> job with a line like:
>
> qvm-backup -d vault -p /tmp/vault-key ?????
qvm-backup --yes --passphrase-file /some/file /backup/dir vmname
then create an executable script with this one-liner and put it in one
of the /etc/cron.* dir (eg weekly, daily). Or, create a specific cron
entry in /etc/cron.d/
> I am not sure about the last part as I would like to put it on an
> external drive so in 3.2 I could have pointed it to the ext drive on
> dom0 but now I am not quite sure where to point it? Ideas?
I backup VMs in dom0 (qvm-backup ... like above) and then copy the
backup file to a mounted dir in an AppVM (could be an external HD, a
NFS/smb share, ...).
eg.:
cat backupfile | qvm-run --pass-io work "cat > /store/dir/qubes/backupfile"
You can backup multiple VMs at once with `qvm-backup` so you can't
specify a target file. A workaround is to create a dedicated target
directory for each qvm-backup "run" and `ls` the file(s) created there
(I prefer to run `qvm-backup` for each vm rather than listing all the
vms at once - it helps with error detection and simplifies scripting).
Here's how you could backup some VMs to /bkpvm in dom0 and then copy the
files to a mount in the 'work' AppVM:
for vm in vault banking; do
bkpdir=/bkpvm/$vm-$(date "+%FT%H%M%S")
mkdir $bkpdir
qvm-shutdown --wait --timeout 60 $vm
qvm-backup --yes --passphrase-file /some/file $bkpdir $vm
bkpfile=$(ls $bkpdir)
cat $bkpfile | qvm-run --pass-io work "cat > /mnt/qubes/backupfile"
done
Note- no guarantee that the above works as-is (I've copied/adapted the
main commands from my backup script).
FWIW backuping large VMs is a waste of resource when there are only a
few files changed. For such VMs I mount an encrypted volume in a
dedicated backup AppVM and rsync the content of the VM there. That's
much, much, much (did I say much ?!) faster and efficient than the
qvm-backup resource hog.
BTW writing a backup strategy doc is on my todo list for more than one
year. Can't get around to writing it :(