PG1X WIKI

My Knowledge Base

User Tools

Site Tools


tech:server:linux:virtualization:kvm-qemu:qemu-img:qemu-img

qemu-img

DO NOT OPERATE ANY MODIFICATION COMMAND(INCLUDING SNAPSHOT OPERATION) ON RUNNING VIRTUAL MACHINE IMAGE!!!!!!! THE OPERATIONS RESULTS IN VIRTUAL MACHINE IMAGE CORRUPTION, LOSE ALL DATA!!!!!!!!!!

MAKE SURE TARGET VM STOPPED THAT CONTAINS THE VM IMAGE.

root@hotaru:/var/lib/libvirt/images# virsh list --inactive | fgrep nextcloud1.example.com
 -     nextcloud1.example.com            shut off
  • list snapshots.
qemu-img snapshot -l nextcloud1.example.com.qcow2

if no snapshots found, result is empty.

  • create a snapshot.
qemu-img snapshot -c "Initial snapshot" nextcloud1.example.com.qcow2

list again.

root@hotaru:/var/lib/libvirt/images# qemu-img snapshot -l nextcloud1.example.com.qcow2
Snapshot list:
ID        TAG                 VM SIZE                DATE       VM CLOCK
1         Initial snapshot          0 2020-01-06 21:53:18   00:00:00.000

snapshot was created successfully.

4 or more snapshots exists, in my experience, VM performance significantly decrease….
  • revert to snapshot
root@hotaru:~# qemu-img snapshot -l /var/lib/libvirt/images/nextcloud1.example.com.qcow2
Snapshot list:
ID        TAG                 VM SIZE                DATE       VM CLOCK
1         Initial snapshot          0 2020-01-06 21:53:18   00:00:00.000
root@hotaru:~# qemu-img snapshot -a 1 /var/lib/libvirt/images/nextcloud1.example.com.qcow2
  • remove snapshot
root@hotaru:~# qemu-img snapshot -l /var/lib/libvirt/images/nextcloud1.example.com.qcow2
Snapshot list:
ID        TAG                 VM SIZE                DATE       VM CLOCK
1         Initial snapshot          0 2020-01-06 21:53:18   00:00:00.000
root@hotaru:~# qemu-img snapshot -c "virt-sysprep" /var/lib/libvirt/images/nextcloud1.example.com.qcow2
root@hotaru:~# qemu-img snapshot -l /var/lib/libvirt/images/nextcloud1.example.com.qcow2
Snapshot list:
ID        TAG                 VM SIZE                DATE       VM CLOCK
1         Initial snapshot          0 2020-01-06 21:53:18   00:00:00.000
2         virt-sysprep              0 2020-01-07 07:05:09   00:00:00.000
root@hotaru:~# qemu-img snapshot -d 1 /var/lib/libvirt/images/nextcloud1.example.com.qcow2
root@hotaru:~# qemu-img snapshot -l /var/lib/libvirt/images/nextcloud1.example.com.qcow2
Snapshot list:
ID        TAG                 VM SIZE                DATE       VM CLOCK
2         virt-sysprep              0 2020-01-07 07:05:09   00:00:00.000

References

tech/server/linux/virtualization/kvm-qemu/qemu-img/qemu-img.txt · Last modified: 2020/01/12 15:18 by wnoguchi