Find a file
2024-07-07 23:47:31 +00:00
.gitignore zfs snapshots?! awe yis! 2024-07-07 19:22:37 -04:00
README.md Update README.md 2024-07-07 23:47:31 +00:00
setup.cfg initial commit from tarball, likely doesn't work at all... 2024-07-07 16:23:53 -04:00
setup.py black 2024-07-07 19:38:06 -04:00
virt-back new version 2024-07-07 19:36:34 -04:00
virtback.py initial commit from tarball, likely doesn't work at all... 2024-07-07 16:23:53 -04:00

usage

root@guile[/mnt/downloads/virt-back]# ./virt-back --help
Usage: virt-back [options]

A backup utility for QEMU, KVM, XEN, and Virtualbox guests. Virt-back is a
python application that uses the libvirt api to safely  shutdown, gzip, and
restart guests.  The backup process logs to syslog for auditing and virt-back
works great with cron for scheduling outages. Virt-back has been placed in the
public domain and  the latest version may be downloaded here:
https://git.unturf.com/python/virt-back

Options:
  -h, --help            show this help message and exit
  -q, --quiet           prevent output to stdout
  -d, --date            append date to tar filename [default: no date]
  -g, --no-gzip         do not gzip the resulting tar file
  -a amount, --retention=amount
                        backups to retain [default: 3]
  -p 'PATH', --path='PATH'
                        backup path [default: '/KVMBACK']
  -u 'URI', --uri='URI'
                        optional hypervisor uri

  Actions for info testing:
    These options display info or test a list of guests.

    -i, --info          info/test a list of guests (space delimited dom names)
    --info-all          attempt to show info on ALL guests

  Actions for a list of dom names:
    WARNING:  These options WILL bring down guests!

    -b, --backup        backup a list of guests (space delimited dom names)
    -r, --reboot        reboot a list of guests (space delimited dom names)
    -s, --shutdown      shutdown a list of guests (space delimited dom names)
    -c, --create        start a list of guests (space delimited dom names)

  Actions for all doms:
    WARNING:  These options WILL bring down ALL guests!

    --backup-all        attempt to shutdown, backup, and start ALL guests
    --reboot-all        attempt to shutdown and then start ALL guests
    --shutdown-all      attempt to shutdown ALL guests
    --create-all        attempt to start ALL guests

How to backup zfs snapshot all KVM instances on a TrueNAS Scale,

root@guile[/mnt/downloads/virt-back]# ./virt-back -u "qemu+unix:///system?socket=/run/truenas_libvirt/libvirt-sock" --backup-all --path /mnt/personal/backup/virt-back --no-gzip --retention 5

shutdown: invoking shutdown on 1_akuma
shutdown: waited 0 seconds for 1_akuma to shut off
backup: invoking backup for 1_akuma
backup: checking if /dev/zvol/downloads/akuma-tfjpo7 is a ZFS dataset
backup: downloads/akuma-tfjpo7 is a ZFS dataset
backup: creating ZFS snapshot downloads/akuma-tfjpo7@backup-2024-07-07-2 for 1_akuma
backup: sending ZFS snapshot downloads/akuma-tfjpo7@backup-2024-07-07-2 to /mnt/personal/backup/virt-back/1_akuma-2024-07-07.zfs for 1_akuma
backup: skipping ISO file /mnt/downloads/iso/ubuntu-24.04-live-server-amd64.iso for 1_akuma
create: invoking create on 1_akuma
backup: rotating backup files for 1_akuma
backup: archiving files for 1_akuma to /mnt/personal/backup/virt-back/1_akuma.tar
backup: archiving /mnt/personal/backup/virt-back/1_akuma.xml for 1_akuma
backup: checking if /dev/zvol/downloads/akuma-tfjpo7 is a ZFS dataset
backup: downloads/akuma-tfjpo7 is a ZFS dataset
backup: archiving /mnt/personal/backup/virt-back/1_akuma-2024-07-07.zfs for 1_akuma
backup: finished backup for 1_akuma