Qemu-img Differences between Snapshots: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * qemu-img =Overview= This is a procedure that can be used to list differences between qemu-img snapshots. It...")
 
 
(8 intermediate revisions by the same user not shown)
Line 13: Line 13:
2. Trigger the event.
2. Trigger the event.


3. Save the state of the filesystem after the event, by cloning the filesystem, with [[Virsh vol-clone|virsh vol-clone]]:
3. Save the state of the filesystem after the event, by cloning the filesystem, with [[Virsh vol-clone|virsh vol-clone]], after the VM guest has been shut down:


  virsh vol-clone --pool main-storage-pool --prealloc-metadata build-guest.qcow2 build-guest-after.qcow2
  virsh vol-clone --pool main-storage-pool --prealloc-metadata build-guest.qcow2 build-guest-after.qcow2
4. Revert the original filesystem to the state before the event, by reverting to snapshot, with [[Qemu-img#Revert_the_Disk_to_a_Saved_State|qemu-img snapshot -a <''snapshot-tag''> <''volume-name''>]].
5. Optionally, delete the snapshot with [[Qemu-img#Delete_the_Snapshot|qemu-img snapshot -d <''snapshot-tag''> <''volume-name''>]].
6. Display the difference:
[[virt-diff#Procedures|virt-diff]] -a <''image-before''> -A <''image-after''>
[[virt-diff#Procedures|virt-diff]] -a /main-storage-pool/build-guest.qcow2 -A /main-storage-pool/build-guest-after.qcow2  > .../diff.txt
7. Delete the cloned "after" filesystem with [[Virsh_vol-delete#Overview|virsh vol-delete ...]]

Latest revision as of 18:58, 18 December 2017

Internal

Overview

This is a procedure that can be used to list differences between qemu-img snapshots. It is probably not optimal, and there are probably tools that do this better, but at the time of the writing, I did not know about them.

Procedure

1. Take a snapshot of the filesystem before the event whose effects you want to analyze: qemu-img snapshot -c ...

2. Trigger the event.

3. Save the state of the filesystem after the event, by cloning the filesystem, with virsh vol-clone, after the VM guest has been shut down:

virsh vol-clone --pool main-storage-pool --prealloc-metadata build-guest.qcow2 build-guest-after.qcow2

4. Revert the original filesystem to the state before the event, by reverting to snapshot, with qemu-img snapshot -a <snapshot-tag> <volume-name>.

5. Optionally, delete the snapshot with qemu-img snapshot -d <snapshot-tag> <volume-name>.

6. Display the difference:

virt-diff -a <image-before> -A <image-after>
virt-diff -a /main-storage-pool/build-guest.qcow2 -A /main-storage-pool/build-guest-after.qcow2  > .../diff.txt

7. Delete the cloned "after" filesystem with virsh vol-delete ...