Backup Rules for VMs
File-system consistent backups require you to freeze I/O operations before backing up the volumes and unfreeze them after the backup is created. Portworx Backup internally creates and runs pre-exec/post-exec rules (freeze/thaw rules) for all VMs before and after creating the VM backup.
If you want to take file-system consistent backups, the following sample values for the pod selector and action fields let you create pre-exec and post-exec rules. Freeze/thaw rules execute virt-freezer within the virt-launcher Pod.
Refer to Add backup rules to create pre-exec and post-exec rules for the VMs.
-
For Portworx Backup to execute the freeze/unfreeze (thaw) rule, both the VM and
qemu-guest-agentmust be in a running state. -
Portworx Backup comes with built-in pre-exec and post-exec rules that freeze and unfreeze the VMs respectively. If you disable the custom rules option while creating VM backups in the Portworx Backup web console, the built-in pre-exec and post-exec rules are applied to your backups. For more details on how to disable the built-in rules, see this topic.
The Pod Selector field value can be found in the virt-launcher Pod.
The following illustration provides sample freeze and unfreeze rules for a VM:
The following shows sample values for the 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 <vm-namespace>
Replace
<vm-name>and<vm-namespace>with the actual name of the VM and VM namespace respectively. - Pod Selector:
-
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 <vm-namespace>
Replace
<vm-name>and<vm-namespace>with the actual name of the VM and VM namespace respectively. - Pod Selector:
The action for freeze/unfreeze can be found by describing the virt-launcher Pod of the VM.
For every VM that you want to back up, ensure that a pod selector, action, and container specific to the VM exist in the pre-exec and post-exec rules.