VM Backup Consistency

From Proxmox VE
Jump to navigation Jump to search

When backups (or snapshots) are triggered for VMs in Proxmox VE, it is necessary to make sure that the guest has written the latest changes to the disk image before the backup starts (or the snapshot is created). This is handled by the Qemu-Guest-Agent inside the guest OS.

The trigger that can be observed in the backup task log:

INFO: issuing guest-agent 'fs-freeze' command
INFO: issuing guest-agent 'fs-thaw' command

This will cause the guest OS to ensure the file-system is in a consistent state. On Windows, it will also trigger VSS, which could need additional configuration if another backup solution is used within the OS. See the Windows section for more details.

Windows

The Qemu-Guest-Agent on Windows guests will use VSS. By default, it will issue VSS_BT_FULL. If other backup solutions are used directly within the Windows guest, this can break their backup chains.

Since version 0.1.262, the Qemu-Guest-Agent for Windows can be configured to use different VSS semantics.

The setting needs to be done via a Registry entry.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\QEMU Guest Agent VSS Provider\VssOption

If the VssOption entry does not exist, create it as 32bit DWORD. The following options are available with the corresponding numerical ID that needs to be configured in the VssOption registry entry:

VSS Types
Number Name
1 VSS_BT_FULL
2 VSS_BT_INCREMENTAL
3 VSS_BT_DIFFERENTIAL
4 VSS_BT_LOG
5 VSS_BT_COPY

More details on the individual backup types can be found in the Microsoft documentation.

If there is no other backup solution involved, leaving it at the default value of 1 (VSS_BT_FULL) should be fine. As soon as another backup solution is used within the Windows guest, chances are high that it relies on VSS. To not interfere, the recommended option is to switch the Qemu-Guest-Agent to use the VSS_BT_COPY option. Therefore, set the VssOption option to the numerical value of 5.

Make sure that the guest agent is enabled in the VM Options panel and that the Freeze/thaw guest filesystems on backup for consistency checkbox is enabled!

Finally reboot the VM to apply the changes.

Yellowpin.svg Note: VSS Event 8194 Access Denied

If you check the Event Viewer → Windows → Application and filter for source VSS, you might see error events with the Event ID 8194.

To fix this, run the dcomcnfg tool via Start (right click) → Run. Go to Console Root → Component Services → Computers → My Computer (right click → Properties). In the tab COM Security in the Access Permission parts, edit the defaults and add the NETWORK SERVICE user and allow Local Access.

Reboot the VM for the changes to take effect.

Linux

It is possible to run custom script on the fs-freeze call. For example, to dump the contents of a database into a file.

Yellowpin.svg Note: The following has been tested on Debian Linux, but it should work very similar on any other distribution.

The Qemu-Guest-Agent needs to be installed:

apt install qemu-guest-agent

The default config does not include the path to the default hook script. Therefore, write out the current running default config into the default file location:

qemu-ga -D > /etc/qemu/qemu-ga.conf

Then all the following line at the end of that file:

fsfreeze-hook=/etc/qemu/fsfreeze-hook

This is the default hook script that will run any executable file in the /etc/qemu/fsfreeze-hook.d/ directory, ignoring files that look like backups (of certain package managers).