Skip to main content
Version: 2.8

Backup rules for VMs

File-system consistent backups require you to freeze IO operations before backing up the volumes and unfreeze them after creation of backups. Portworx Backup internally creates and runs pre-exec/post-exec rules (freeze/thaw rules) for all the VMs before and after creating the VM backup.

If you want to take file-system consistent backups, here are the sample values for pod selector and action field to create pre-exec and post-exec rules. Freeze/thaw rules execute virt-freezer within the virt-launcher pod.

Refer Create Backup Rules to create pre-exec and post-exec rules for the VMs.

note
  • For Portworx Backup to execute the freeze/unfreeze (thaw) rule, both VM and qemu-guest-agent should be in running state.

  • Portworx Backup comes with built-in pre-exec and post-exec rules that wil freeze and unfreeze the VMs respectively. If you disable the custom rules option while creating VM backups in the PXB web console, built-in pre-exec and post-exec rules rules get applied to your backups. Refer to this link for more details on how to disable the built-in rules.

note

Pod Selector field can be fetched from virt-launcher pod.

Following illustration provides sample freeze and unfreeze rules for a VM:




Here is a sample value for Pod Selector and Action fields for pre-exec and post-exec rules:

  • Pre-exec rule value for freeze:

    • Pod Selector: vm.kubevirt.io/name=<vm-name>
    • Container: compute
    • Action: /usr/bin/virt-freezer --freeze --name <vm-name> --namespace <namespace>

    Replace <vm-name> with actual name of the VM

  • Post-exec rule value for unfreeze/thaw:

    • Pod Selector: vm.kubevirt.io/name=<vm-name>
    • Container: compute
    • Action: /usr/bin/virt-freezer --unfreeze --name <vm-name> --namespace <namespace>

    Replace <vm-name> with actual name of the VM

The action for freeze/unfreeze can be fetched by describing the virt-launcher pod of the VM.

note

For every VM that you want to back up, make sure there exists a pod-selector, action, and container specific to the VM in the pre-exec and post-exec rules.