Qvm-backup over ssh

Hi, I’m a bit confused about the documentation at How to back up, restore, and migrate | Qubes OS
Specifically, it says

Likewise, it is possible to enter any command as a backup target by specifying the command as the destination in the VM. This can be used to send your backup directly to, e.g., a remote server using SSH.

That’s exactly what I want to do. I have ssh access to a server where I want to store the backup. What would the command (or the argument of destination_path in the backup profile) look like to make this happen?

Thanks

1 Like

Your backup will be piped to the command:
something like ssh user@IP 'cat >/path/to/backupfile'

Or have a script to handle this and redate/increment the filenames.

1 Like

Oh no! I thought I had replied. Thanks so much for your answer, it’s exactly what I was looking for.

On this official Qubes OS documentation page it says

A backup is useless if you can’t restore your data from it, and you can’t be sure that your backup is good until you try to restore.

But it doesn’t say how to use qvm-backup-restore on a file that has been sent to the SSH server already.

Can anyone give me some example code or pointers for how to test backups that are only accessible over the network via SSH?

You have to make them available, either by bringing back to the qube, or
by (e.g.) using sshfs

I never presume to speak for the Qubes team.
When I comment in the Forum or in the mailing lists I speak for myself.

qvm-backup-restore is similar to qvm-backup, both can take a command instead of a filename. If you created a backup by incorporating @unman’s syntax example like

qvm-backup --dest-vm=foo "ssh user@IP 'cat >/path/to/backupfile'"

then to restore it use

qvm-backup-restore --dest-vm=foo "ssh user@IP 'cat /path/to/backupfile'"

The only (important!) change is that the redirection operator > has been omitted, because now you want cat to read from the file after previously writing to it.

2 Likes

Thanks @unman , I tried SSHFS and it seems a viable solution to use in automated backup scripts.

Thanks @rustybird for that syntax. I haven’t managed to get it to work like in this topic and this topic in combination with ls and head to automatically locate the path to the latest backup, but hopefully will eventually come up with a simple script that works.

On a side note, I appreciate very much you Qubes veterans still chiming in to help Qubes noobs like me. Your patience is admirable and encouraging.

I wrote how to pipe your backups into restic if you prefer, this allows you to use all the rclone compatible remote storage :slight_smile: