centos6.5虚拟机快照技术
一、查看现有磁盘镜像格式与转换
查看磁盘格式
[root@localhost ~]# qemu-img info /var/lib/libvirt/images/centos7.img
image: /var/lib/libvirt/images/centos7.img
file format: raw
virtual size: .0G ( bytes)
disk size: .0G
安装电源服务
# yum install acpid -y
关闭虚拟机
#virsh shutdown centos7
转换磁盘格式
# qemu-img convert -f raw -O qcow2 /var/lib/libvirt/images/centos7.img /var/lib/libvirt/images/centos7.qcow2
-f-------源镜像的格式
-O-----目标镜像的格式
查看转换后的磁盘大小
[root@localhost ~]# du -sh /var/lib/libvirt/images/centos7.qcow2
.4G /var/lib/libvirt/images/centos7.qcow2
查看转换后的磁盘格式
[root@localhost ~]# qemu-img info /var/lib/libvirt/images/centos7.qcow2
image: /var/lib/libvirt/images/centos7.qcow2
file format: qcow2
virtual size: .0G ( bytes)
disk size: .4G
cluster_size:
二、修改虚拟机配置文件
修改磁盘格式
# virsh edit centos7
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/var/lib/libvirt/images/centos7.qcow2'/>
<target dev='hda' bus='ide'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<disk type='block' device='cdrom'>
<driver name='qemu' type='raw'/>
<target dev='hdc' bus='ide'/>
<readonly/>
<address type='drive' controller='' bus='' target='' unit=''/>
</disk>

三、对虚拟机进行快照管理
创建centos7虚拟机快照
注意:需要修改磁盘格式
[root@localhost ~]# virsh snapshot-create-as centos7 centos7_snaphshot
Domain snapshot centos7_snaphshot created
[root@localhost ~]#
查看虚拟机镜像快照的版本
# virsh snapshot-list centos7

查看当前虚拟机镜像快照的版本
可以看到为当前最新的快照版本
[root@localhost ~]# virsh snapshot-current centos7
<domainsnapshot>
<name>centos7_snaphshot</name>
<state>shutoff</state>
<creationTime>1547653724</creationTime>
<memory snapshot='no'/>
<disks>
<disk name='hda' snapshot='internal'/>
<disk name='hdc' snapshot='no'/>
</disks>
<domain type='kvm'>
<name>centos7</name>
<uuid>92827f3a-d304-dc83-5ad1-d62f2a755ca3</uuid>
<memory unit='KiB'></memory>
<currentMemory unit='KiB'></currentMemory>
<vcpu placement='static'></vcpu>
<os>
<type arch='x86_64' machine='rhel6.5.0'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/var/lib/libvirt/images/centos7.qcow2'/>
<target dev='hda' bus='ide'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<disk type='block' device='cdrom'>
<driver name='qemu' type='raw'/>
<target dev='hdc' bus='ide'/>
<readonly/>
<address type='drive' controller='' bus='' target='' unit=''/>
</disk>
<controller type='ide' index=''>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<controller type='usb' index=''/>
<interface type='network'>
<mac address='52:54:00:07:f7:16'/>
<source network='default'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port=''/>
</serial>
<console type='pty'>
<target type='serial' port=''/>
</console>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='cirrus' vram='' heads=''/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</memballoon>
</devices>
</domain>
</domainsnapshot>
查看快照
# virsh snapshot-info centos7 centos7_snaphshot

四、恢复虚拟机快照
1、恢复虚拟机快照必须关闭虚拟机
查看虚拟机是否是关闭状态
# virsh domstate centos7

确认需要恢复的快照时间,恢复到centos7_snaphshot
# virsh snapshot-list centos7

3、执行恢复并确认恢复版本
# virsh snapshot-revert centos7 centos7_snaphshot

查看当前虚拟机镜像快照的版本
[root@localhost ~]# virsh snapshot-current centos7
<domainsnapshot>
<name>centos7_snaphshot</name>
<state>shutoff</state>
<creationTime></creationTime>
<memory snapshot='no'/>
<disks>
<disk name='hda' snapshot='internal'/>
<disk name='hdc' snapshot='no'/>
</disks>
<domain type='kvm'>
<name>centos7</name>
<uuid>92827f3a-d304-dc83-5ad1-d62f2a755ca3</uuid>
<memory unit='KiB'></memory>
<currentMemory unit='KiB'></currentMemory>
<vcpu placement='static'></vcpu>
<os>
<type arch='x86_64' machine='rhel6.5.0'>hvm</type>
<boot dev='hd'/>
</os>
五、 删除虚拟机快照
1、查看虚拟机快照
# qemu-img info /var/lib/libvirt/images/centos7.qcow2

2、删除快照
# virsh snapshot-delete centos7 centos7_snaphshot

# virsh snapshot-delete centos7 centos7_snaphshot

centos6.5虚拟机快照技术的更多相关文章
- vmware vSphere克隆与快照技术
		
通过Web vCenter我们可以很容易的对虚拟机进行管理,通过克隆技术或创建模板,我们可以迅速的创建虚拟机,我们也可以通过快照技术去捕获虚拟机的一些状态,比如说虚拟机的内存.设置或者虚拟磁盘的情况等 ...
 - KVM虚拟机快照链创建,合并,删除及回滚研究
		
1 QEMU,KVM,libvirt关系 QEMU QEMU提供了一个开源的服务器全虚拟化解决方案,它可以使你在特定平台的物理机上模拟出其它平台的处理器,比如在X86 CPU上虚拟出Power的CPU ...
 - 再谈 COW、ROW 快照技术
		
目录 目录 前言 快照与备份的区别 快照技术 增量快照之 COW 增量快照之 row 前言 在经过了一段时间的实践之后,再次回顾 COW/ROW 快照技术的实现原理,温故而知新. 快照与备份的区别 传 ...
 - Redhat6.x下如何制作虚拟机快照和镜像封装
		
一.虚拟机快照 1.确认你的物理机上的vg还有足够的剩余空间 [root@hacker ~]# vgs VG #PV #LV #SN Attr VSize VFree vg_ ...
 - centos6.6 虚拟机集群搭建
		
1.centosos6.6下载 windows 64位: thunder://QUFodHRwOi8vbGludXguemh1YW5neGl0b25nLmNvbTo4MDgvMjAxNTAxL0Nlb ...
 - 分布式存储 CentOS6.5虚拟机环境搭建FastDFS-5.0.5集群(转载-2)
		
原文:http://www.cnblogs.com/PurpleDream/p/4510279.html 分布式存储 CentOS6.5虚拟机环境搭建FastDFS-5.0.5集群 前言: ...
 - vmware克隆Centos6.7虚拟机网卡无法启动问题
		
快速处理办法: cat /etc/sysconfig/network-scripts/ifcfg-eth0 sed -i '/UUID/d' /etc/sysconfig/network-script ...
 - kvm+libvirt虚拟机快照浅析[转]
		
浅析snapshots, blockcommit,blockpull 作者:Kashyap Chamarthy <kchamart#redhat.com> Date: Tue, 23 Oc ...
 - centos6.5虚拟机无法访问外网解决办法
		
安装了centos6.5虚拟机,使用的是桥接方式.把所有的配置已经写到/etc/sysconfig/network-scripts/ifcfg-eth0中后,发现内网可以ping通,外网却无法访问. ...
 
随机推荐
- 线程---同步(synchronized)
			
实现线程同步的一种方式介绍: 思路: 首先,需要被协调的类,先实现线程,并重写run方法 然后,在被协调的类中私有化控制器,控制器实例化,由构造器带入. 其次,由控制器对象具体负责调用. 举例:循环输 ...
 - UVA1455 【Kingdom】
			
分析 直线都是\(y=\overline{a.5}\)这种形式,而只查询州和城市的个数,所以很容易想到对\(y\)轴做投影,然后转化为区间修改(加减)和单点查询,可以用线段树维护.至于每个州只会合并不 ...
 - SQL Server 表分区备忘
			
1.创建的代码如下: )) AS RANGE LEFT FOR VALUES ( N', N', N',... ) CREATE PARTITION SCHEME [01_SubjectiveScor ...
 - 梯度下降与pytorch
			
记得在tensorflow的入门里,介绍梯度下降算法的有效性时使用的例子求一个二次曲线的最小值. 这里使用pytorch复现如下: 1.手动计算导数,按照梯度下降计算 import torch #使用 ...
 - python基础(四)——正则表达式
			
#!/usr/bin/python # -*- coding: utf-8 -*- import re print(re.match('www', 'www.runoob.com').span()) ...
 - python生成随机数、随机字符串
			
python生成随机数.随机字符串 import randomimport string # 随机整数:print random.randint(1,50) # 随机选取0到100间的偶数:print ...
 - WyBox 7620a 启用第二个串口
			
要修改的文件有两个 mt7620a.dtsi MT7620a.dts 1.进入target/linux/ramips/dts/ mt7620a.dtsi 把”disabled”改为”ok”,添加两行 ...
 - php+phpspreadsheet读取Excel数据存入mysql
			
先生成Excel模板,然后导入Excel数据到mysql,每条数据对应图片上传到阿里云 <?php /** * Created by PhpStorm. * User: Administrato ...
 - 开源截图工具cutycapt的安装及使用
			
之前在安装过程中碰到很多问题,也找了不少资料.现总结了下,给有需要的朋友.centos下安装cutycapt比较麻烦,需要先安装qt47,再下载cutycapt源码编译;而在ubuntu下安装cuty ...
 - 5分钟搭建 nginx +php --------------(LNMP)新手专用
			
5分钟搭建 nginx +php --------------(LNMP)新手专用 2014-11-14 16:48 88876人阅读 评论(2) 收藏 举报 版权声明:本文为博主原创文章,未经博主允 ...