[pve-devel] Script for bug #2874

Fiona Ebner f.ebner at proxmox.com
Fri Jan 27 14:49:20 CET 2023


The attached script allows monitoring the first sector of the bootdisk
for running VMs (all or a selection of IDs) for people affected by bug
#2874 [0]. The hope is to pinpoint when the sector gets corrupted to be
able to correlate the timing with operations that might cause it. The
script also dumps the contents, because it might help to see how the
sector gets corrupted.

Note that the script needs to be executed on each node and that you can
specify IDs for VMs not currently on that node, which is useful to catch
migrating VMs (or don't specify any IDs to monitor all running VMs).

The script parses the VM config to determine the boot disk, looks up the
path and uses qemu-img dd and base64 to save the contents of the first
512 bytes in a non-binary format and will dump the contents whenever
they change.

Example invocations:
# monitor all running VMs, check every 5 minutes
perl monitor-sector-zero.pl --interval 300
# only monitor 166 and 167, check every minute, log to file
perl monitor-sector-zero.pl 166 167 &> /path/to/file

Feedback from users and other developers is highly appreciated!

[0]: https://bugzilla.proxmox.com/show_bug.cgi?id=2874


More information about the pve-devel mailing list