External (and Live) snapshots with libvirt
list all the block devices associated with the guest
$ virsh domblklist testvm --details
Type Device Target Source
------------------------------------------------
file disk vda /export/vmimgs/testvm.qcow2
let’s create a snapshot(disk-only) of the guest
$ virsh snapshot-create-as testvm snap1-testvm "snap1 description" \
--diskspec vda,file=/export/vmimgs/snap1-testvm.qcow2 \
--disk-only --atomic
– ‘–atomic’ just ensures either the snapshot is run completely or fails w/o making any changes
$ qemu-img info /export/vmimgs/snap1-testvm.qcow2
image: /export/vmimgs/snap1-testvm.qcow2
file format: qcow2
virtual size: 20G ( bytes)
disk size: 2.5M
cluster_size:
backing file: /export/vmimgs/testvm.qcow2
$
created 2 more snapshots
$ virsh snapshot-list testvm --tree snap1-testvm
|
+- snap2-testvm
|
+- snap3-testvm
image file chain[ base<-snap1<-snap2<-snap3 ]:
#--------------------------------------------#
$ qemu-img info /export/vmimgs/snap3-testvm.qcow2
image: /export/vmimgs/snap3-testvm.qcow2
file format: qcow2
virtual size: 20G ( bytes)
disk size: 129M
cluster_size:
backing file: /export/vmimgs/snap2-testvm.qcow2
#--------------------------------------------#
$ qemu-img info /export/vmimgs/snap2-testvm.qcow2
image: /export/vmimgs/snap2-testvm.qcow2
file format: qcow2
virtual size: 20G ( bytes)
disk size: 3.6M
cluster_size:
backing file: /export/vmimgs/snap1-testvm.qcow2
#--------------------------------------------#
$ qemu-img info /export/vmimgs/snap1-testvm.qcow2
image: /export/vmimgs/snap1-testvm.qcow2
file format: qcow2
virtual size: 20G ( bytes)
disk size: 2.5M
cluster_size:
backing file: /export/vmimgs/testvm.qcow2
$
#--------------------------------------------#
Now, if we do not need snap2 any more, and want to pull all the data from snap1 into snap3, making snap1 as snap3’s backing file, we can do a virsh blockpulloperation as below:
$ virsh blockpull --domain testvm \
--path /export/vmimgs/snap3-testvm.qcow2 \
--base /export/vmimgs/snap1-testvm.qcow2 \
--wait --verbose
Block Pull: [ %]
Pull complete
可以看到snap3的backup为snap1
$ qemu-img info /export/vmimgs/snap3-testvm.qcow2
image: /export/vmimgs/snap3-testvm.qcow2
file format: qcow2
virtual size: 20G ( bytes)
disk size: 145M
cluster_size:
backing file: /export/vmimgs/snap1-testvm.qcow2
但snapshot-list 仍显示snap2
$ virsh snapshot-list testvm --tree
snap1-testvm
|
+- snap2-testvm
|
+- snap3-testvm
所以仍可以恢复为
base <- snap123
External disk-snapshots(live) using RAW as original image:
源disk image 不变为raw,而snapshot为qcow2
internal snapshots会导致源disk image变成qcow2
External (and Live) snapshots with libvirt的更多相关文章
- [转] External(and Live) snapshots with libvirt
http://kashyapc.com/ Raw image is a blob of data exposed directly in VM as block device, it can't sn ...
- 别以为真懂Openstack: 虚拟机创建的50个步骤和100个知识点(3)
四.Nova-compute 步骤17:nova-compute接收到请求后,通过Resource Tracker将创建虚拟机所需要的资源声明占用 步骤18:调用Neutron API配置Networ ...
- QEMU KVM Libvirt手册(5) – snapshots
前面讲了QEMU的qcow2格式的internal snapshot和external snapshot,这都是虚拟机文件格式的功能. 这是文件级别的. 还可以是文件系统级别的,比如很多文件系统支持s ...
- KVM 介绍(7):使用 libvirt 做 QEMU/KVM 快照和 Nova 实例的快照 (Nova Instances Snapshot Libvirt)
学习 KVM 的系列文章: (1)介绍和安装 (2)CPU 和 内存虚拟化 (3)I/O QEMU 全虚拟化和准虚拟化(Para-virtulizaiton) (4)I/O PCI/PCIe设备直接分 ...
- kvm+libvirt虚拟机快照浅析[转]
浅析snapshots, blockcommit,blockpull 作者:Kashyap Chamarthy <kchamart#redhat.com> Date: Tue, 23 Oc ...
- External Snapshot management
External Snapshot management Symptom As of at least libvirt 1.1.1, external snapshot support is inco ...
- QEMU KVM libvirt手册(4) – images
RAW raw是默认的格式,格式简单,容易转换为其他的格式.需要文件系统的支持才能支持sparse file 创建image # qemu-img create -f raw flat.img 10G ...
- [转] Snapshotting with libvirt for qcow2 images
http://kashyapc.com/2011/10/04/snapshotting-with-libvirt-for-qcow2-images/ Libvirt 0.9.6 was recentl ...
- KVM(七)使用 libvirt 做 QEMU/KVM 快照和 Nova 实例的快照
本文将梳理 QEMU/KVM 快照相关的知识,以及在 OpenStack Nova 中使用 libvirt 来对 QEMU/KVM 虚机做快照的过程. 1. QEMU/KVM 快照 1.1 概念 QE ...
随机推荐
- 关于webpack打包js和css
废话不多说,直接贴出代码,大家瞅瞅:其中要引用css的话是要用css-loader.用了之后再webpack.config.js里面配置相应的代码,并且在相应的js文件里面引用即可啦,不知道有哪位大神 ...
- 获取html元素所在页面的坐标
function findPosition(oElement) { var x2 = 0; var y2 = 0; var width = oElement.offsetWidth; var heig ...
- 如何运行Python程序
注:以下均基于windows下操作,并且安装的是最新的python3.3版本. 安装完python之后,我们可以做两件事情, 1.将安装目录中的Doc目录下的python331.chm使用手册复制到桌 ...
- 巨蟒django之CRM5 学习记录&&课程记录&&班级管理&&私户的数量上限
1.公户变私户(事务+行级锁) 2.私户的数量上限 3.班级的管理 4.课程记录管理 5.学习记录的初始化 6.展示和编辑学习记录
- You can add an index on a column that can have NULL values if you are using the MyISAM, InnoDB, or MEMORY storage engine.
w https://dev.mysql.com/doc/refman/5.7/en/create-index.html MySQL :: MySQL 5.7 Reference Manual :: B ...
- entropy 压缩信息的熵更加高 实际上英文文本的熵大概只有4.7比特
https://en.wikipedia.org/wiki/Entropy_(information_theory) https://zh.wikipedia.org/wiki/熵(信息论) 熵的概念 ...
- [mysql]清除单表大量数据方法(需保留部分数据)
大半夜的在删除线上的日志数据,需要清理的大概有1亿八千万条...任务艰巨. 毕业前没学过数据库,所以对于如何清理大量数据还真一时不知道该怎么办才好.刚开始确实想过对表进行重命名的方式来处理,不过当时因 ...
- Java源码之Object
本文出自:http://blog.csdn.net/dt235201314/article/details/78318399 一丶概述 JAVA中所有的类都继承自Object类,就从Object作为源 ...
- PS导出@3x、@2x、@1x格式的iOS切图神器-Retinize
Retinize动作下载地址:http://retinize.it/ 使用:ps-载入动作-选中图片-执行动作
- Python线程包装器
import threading import subprocess import time def need_thread(func, *args, **kwargs): def fun(): pr ...