On Sun, 2024-09-22 at 16:53 +0000, shadowbladeee wrote: > Hello List, > > I have a KVM server running about 40 VMs these are a large variety of > OSes ranging from different Linux version, Windows 7s, OpenBSD, > NetBSD, FreeBSD machines. > I looking for a proper way to back these up, I don't expect features > like Vmware's Vmotion to move them live to another server however I > would like to move them offline to another server and in case the > sever explodes all I would have to do is spin up the same VMs with a > script. > > Sounds easy but none of the solutions what I found so far are > perfect. First I was just doing rsync based backup of the .qcows > images to the other server, this "mostly" works with Linux and > Windows however the BSDs don't like it they go from file system > corruptions at boot time (which is still fixable manually) to the > point the KVM doesn't even boot. > > Shutting down the VMs to do the backup is not an option. > > I have tried these 2 methods: > > https://libvirt.org/kbase/live_full_disk_backup.html > > https://github.com/abbbi/virtnbdbackup?tab=readme-ov-file#complete-restore > > Makes absolutely no difference, the same issues come out with the VMs > then if I would just rsync them. In order for a guest OS to be able to boot cleanly from an image backup, the guest filesystem must be in a consistent state when the backup is created, and to ensure this you need cooperation from the guest during the backup. When using QEMU, this is usually achieved via the QEMU Guest Agent (QGA), which is what is likely missing in your VMs. On Ubuntu/Debian Linux distros, you can install QGA via `apt install qemu-guest-agent`. I don't know if there are pre-built binary releases available for Windows and *BSD, but the QGA code is part of the QEMU source tree, at https://gitlab.com/qemu-project/qemu/-/tree/master/qga?ref_type=heads, so you could compile it from source. If QGA is installed and running in your VM, it will take care of freezing the guest filesystem before beginning a backup, and thawing it after the backup is complete. This should work with both methods (libvirt-based and virtnbdbackup) you referenced above; if you use virtnbdbackup, see https://github.com/abbbi/virtnbdbackup?tab=readme-ov-file#application-consistent-backups for additional details and options.