Backup:Qemu-Agent doesn't Freeze VM

Nogschu

New Member
May 2, 2018
5
0
1
32
Hi there,
I am using Proxmox Virtual Environment 4.4-22
As in the title I got a little problem with the qemu agent.
I installed the qemu-guest-agent in my Centos 7 VM an set agent=1.
I can ping the agent and freeze the FS manually, but when it's doing backups (snapshot mode)
it doesn't freeze the FS automatically. But I think it should do it with the qemu agent.
Is there something i missed while configuring it?

Backup Output :

INFO: starting new backup job: vzdump 100 --mailnotification always --mode snapshot --compress lzo --quiet 1 --storage local
INFO: Starting Backup of VM 100 (qemu)
INFO: status = running
INFO: update VM 100: -lock backup
INFO: VM Name: AgentTest
INFO: include disk 'virtio0' 'local-lvm:vm-100-disk-1' 32G
INFO: backup mode: snapshot
INFO: ionice priority: 7
INFO: creating archive '/var/lib/vz/dump/vzdump-qemu-100-2018_05_02-11_52_02.vma.lzo'
INFO: started backup task '59fa58e3-fe82-4e12-a7c2-91b21b5959ed'
INFO: status: 9% (3247964160/34359738368), sparse 9% (3092533248), duration 3, 1082/51 MB/s
INFO: status: 10% (3451650048/34359738368), sparse 9% (3095388160), duration 6, 67/66 MB/s
INFO: status: 11% (3918856192/34359738368), sparse 9% (3184742400), duration 13, 66/53 MB/s
INFO: status: 25% (8758493184/34359738368), sparse 23% (7924441088), duration 16, 1613/33 MB/s
INFO: status: 32% (11084038144/34359738368), sparse 29% (10171949056), duration 19, 775/26 MB/s
INFO: status: 33% (11672420352/34359738368), sparse 30% (10516099072), duration 23, 147/61 MB/s
INFO: status: 54% (18656526336/34359738368), sparse 50% (17500205056), duration 26, 2328/0 MB/s
INFO: status: 55% (18935709696/34359738368), sparse 51% (17633886208), duration 29, 93/48 MB/s
INFO: status: 64% (22243639296/34359738368), sparse 60% (20789039104), duration 32, 1102/50 MB/s
INFO: status: 77% (26623082496/34359738368), sparse 73% (25116459008), duration 35, 1459/17 MB/s
INFO: status: 78% (26826244096/34359738368), sparse 73% (25121325056), duration 38, 67/66 MB/s
INFO: status: 97% (33587003392/34359738368), sparse 92% (31879606272), duration 41, 2253/0 MB/s
INFO: status: 100% (34359738368/34359738368), sparse 95% (32652341248), duration 42, 772/0 MB/s
INFO: transferred 34359 MB in 42 seconds (818 MB/s)
INFO: archive file size: 960MB
INFO: delete old backup '/var/lib/vz/dump/vzdump-qemu-100-2018_05_02-11_45_02.vma.lzo'
INFO: Finished Backup of VM 100 (00:00:43)
INFO: Backup job finished successfully​
TASK OK
 
I can ping the agent and freeze the FS manually, but when it's doing backups (snapshot mode)
it doesn't freeze the FS automatically. But I think it should do it with the qemu agent.


No, it does not. Freeze it not necessary for snapshot backup.
 
Hi Richard,
the thing is that I am running a MYSQL Database on this Server and the Database can write while the backups so there is a possibility that my database is not consistent after restoring it.
And I read several threads about it there people are freezing the FS with qemu agent while backups with snapshot mode (no stop or suspend)
I installed the qemu agent and did everything in the documentation but it doesn't freezes while the backups are running.
How do I do that?
 
the thing is that I am running a MYSQL Database on this Server and the Database can write while the backups so there is a possibility that my database is not consistent after restoring it.
And I read several threads about it there people are freezing the FS with qemu agent while backups with snapshot mode (no stop or suspend)
I installed the qemu agent and did everything in the documentation but it doesn't freezes while the backups are running.


Snapshot mode takes care about data consistency; i.e. writing during backup process is ignored for the backup.

If you don't trust this method (and you want to avoid any write attempt during backup process) use Backup in Suspend mode.
 
That's strange
Snapshot mode takes care about data consistency; i.e. writing during backup process is ignored for the backup.

If you don't trust this method (and you want to avoid any write attempt during backup process) use Backup in Suspend mode.

That's strange, vzdump code execute fsfreeze/unfreeze juste before executing the backup:
(But I don't think that a message is displayed in the log)

/usr/share/perl5/PVE/VZDump/QemuServer.pm

Code:
        my $agent_running = 0;

        if ($self->{vmlist}->{$vmid}->{agent} && $vm_is_running) {
            $agent_running = PVE::QemuServer::qga_check_running($vmid);
        }

        if ($agent_running){
            eval { PVE::QemuServer::vm_mon_cmd($vmid, "guest-fsfreeze-freeze"); };
            if (my $err = $@) {
                $self->logerr($err);
            }
        }

        $qmpclient->queue_execute();

        if ($agent_running){
            eval { PVE::QemuServer::vm_mon_cmd($vmid, "guest-fsfreeze-thaw"); };
            if (my $err = $@) {
                $self->logerr($err);
            }
        }

@Nogschu
specific to mysql, you can also add a hook in your qemu agent.
https://github.com/qemu/qemu/blob/m...t-agent/fsfreeze-hook.d/mysql-flush.sh.sample
 
That's strange


That's strange, vzdump code execute fsfreeze/unfreeze juste before executing the backup:
(But I don't think that a message is displayed in the log)


Hi @spirit,
Thanks for the script. Is it still in QemuServer.pm or do I have to add it because i couldn't find it there.
The agent doesn't shows something in the log so I did the
Code:
root@pve:~# qm agent 100 fsfreeze-status
command
and the result is that it's thawed the whole time so it doesn't hooks any ideas why?
 
Last edited:
it is still there, but the freeze state is very short. there are two prerequisites: the agent flag in the VM config must be set, and the agent must be running. the freeze and thaw happen right before the log message "started backup task 'XYZ'".
 
Ah, now I think I got it, when Proxmox is making a Backup in snapshot mode it ist just watching at one point of time and the freeze is just while that point to get sure that nothing would be written than and is thawing after it, right?
 
Ah, now I think I got it, when Proxmox is making a Backup in snapshot mode it ist just watching at one point of time and the freeze is just while that point to get sure that nothing would be written than and is thawing after it, right?
yes.

proxmox do :

freeze-fs (to flush data on disk)
start backup with "snapshot", mean backup this state of disk.
and unfreeze-fs (backup is already start) (so it's just 1 or 2 second later)

then stop backup at the end of the job. (some minutes/hours laters)


you can launch qemu guest agent manually with verbose , to see if commands are receive on guest.

/usr/sbin/qemu-ga -m virtio-serial -p /dev/virtio-ports/org.qemu.guest_agent.0 -v
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!