1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > kvm虚拟化学习笔记(十)之kvm虚拟机快照备份

kvm虚拟化学习笔记(十)之kvm虚拟机快照备份

时间:2021-06-02 09:53:41

相关推荐

kvm虚拟化学习笔记(十)之kvm虚拟机快照备份

KVM虚拟化学习笔记系列文章列表

----------------------------------------

kvm虚拟化学习笔记(一)之kvm虚拟化环境安装

http://koumm./703525/1288795

kvm虚拟化学习笔记(二)之linuxkvm虚拟机安装

http://koumm./703525/1289627

kvm虚拟化学习笔记(三)之windowskvm虚拟机安装

http://koumm./703525/1290191

kvm虚拟化学习笔记(四)之kvm虚拟机日常管理与配置

http://koumm./703525/1290269

kvm虚拟化学习笔记(五)之windows虚拟机性能调整

http://koumm./703525/1290682

kvm虚拟化学习笔记(六)之kvm虚拟机控制台登录配置

http://koumm./703525/1290996

kvm虚拟化学习笔记(七)之kvm虚拟机克隆

http://koumm./703525/1291793

kvm虚拟化学习笔记(八)之kvm虚拟机vnc配置

http://koumm./703525/1291803

kvm虚拟化学习笔记(九)之kvm虚拟机时间配置

http://koumm./703525/1291862

kvm虚拟化学习笔记(十)之kvm虚拟机快照备份

http://koumm./703525/1291893

kvm虚拟化学习笔记(十一)之kvm虚拟机扩展磁盘空间

http://koumm./703525/1292146

kvm虚拟化学习笔记(十二)之kvmlinux虚拟机在线扩展磁盘

http://koumm./703525/1295296

kvm虚拟化学习笔记(十三)之kvm虚拟机磁盘文件读取小结

http://koumm./703525/1298845

kvm虚拟化学习笔记(十四)之kvm虚拟机静态迁移

http://koumm./703525/1298852

kvm虚拟化学习笔记(十五)之kvm虚拟机动态迁移

http://koumm./703525/1300783

kvm虚拟化学习笔记(十六)之kvm虚拟化存储池配置

http://koumm./703525/1304196

kvm虚拟化学习笔记(十七)之KVM到KVM之v2v迁移

http://koumm./703525/1304271

kvm虚拟化学习笔记(十八)之ESXi到KVM之v2v迁移

http://koumm./703525/1304461

kvm虚拟化学习笔记(十九)之convirt集中管理平台搭建

http://koumm./703525/1305553

kvm虚拟化学习笔记(二十)之convirt安装linux系统

http://koumm./703525/1306526

kvm虚拟机默认使用raw格式的镜像格式,性能最好,速度最快,它的缺点就是不支持一些新的功能,如支持镜像,zlib磁盘压缩,AES加密等。

要使用镜像功能,磁盘格式必须为qcow2。下面开始kvm虚拟机快照备份的过程。

本文出自:http://koumm.

进一步的学习参考:kvm+libvirt虚拟机快照浅析/blog/content/130

1.查看现有磁盘镜像格式与转换

(1)查看磁盘格式

#qemu-imginfotest01.img

raw格式需要转换成qcow2

(2)关闭虚拟机并转换磁盘

#virshshutdownoeltest01

(3)转换磁盘格式

#qemu-imgconvert-fraw-Oqcow2test01.imgtest01.qcow2

-f源镜像的格式

-O目标镜像的格式

查看转换后的格式,已经转换成了qcow2,这里是拷贝一份,并将格式转成qcow2

#qemu-imginfotest01.qcow2

2.修改虚拟机配置文件

修改磁盘格式,与新qcow2格式的磁盘。

3.对虚拟机进行快照管理

(1)对oeltest01虚拟机创建快照

也可以virshsnapshot-createasoeltest01snap1创建后个快照别名。

(2)查看虚拟机镜像快照的版本

(3)查看当前虚拟机镜像快照的版本

可以看到为当前最新的快照版本。

[root@node1data]#

[root@node1data]#virshsnapshot-currentoeltest01

<domainsnapshot>

<name>1378579737</name>

<state>shutoff</state>

<creationTime>1378579737</creationTime>

<memorysnapshot='no'/>

<disks>

<diskname='hda'snapshot='internal'/>

<diskname='hdc'snapshot='no'/>

</disks>

<domaintype='kvm'>

<name>oeltest01</name>

<uuid>8f2bb4a7-c7ed-32aa-3676-9fb05923269d</uuid>

<memoryunit='KiB'>524288</memory>

<currentMemoryunit='KiB'>524288</currentMemory>

<vcpuplacement='static'>1</vcpu>

<os>

<typearch='x86_64'machine='rhel6.4.0'>hvm</type>

<bootdev='hd'/>

</os>

<features>

<acpi/>

<apic/>

<pae/>

</features>

<clockoffset='localtime'/>

<on_poweroff>destroy</on_poweroff>

<on_reboot>restart</on_reboot>

<on_crash>restart</on_crash>

<devices>

<emulator>/usr/libexec/qemu-kvm</emulator>

<disktype='file'device='disk'>

<drivername='qemu'type='qcow2'cache='none'/>

<sourcefile='/data/test01.qcow2'/>

<targetdev='hda'bus='ide'/>

<addresstype='drive'controller='0'bus='0'target='0'unit='0'/>

</disk>

<disktype='block'device='cdrom'>

<drivername='qemu'type='raw'/>

<targetdev='hdc'bus='ide'/>

<readonly/>

<addresstype='drive'controller='0'bus='1'target='0'unit='0'/>

</disk>

<controllertype='ide'index='0'>

<addresstype='pci'domain='0x0000'bus='0x00'slot='0x01'function='0x1'/>

</controller>

<controllertype='usb'index='0'/>

<interfacetype='bridge'>

<macaddress='52:54:00:82:39:01'/>

<sourcebridge='br0'/>

<modeltype='virtio'/>

<addresstype='pci'domain='0x0000'bus='0x00'slot='0x03'function='0x0'/>

</interface>

<serialtype='pty'>

<targetport='0'/>

</serial>

<consoletype='pty'>

<targettype='serial'port='0'/>

</console>

<inputtype='tablet'bus='usb'/>

<inputtype='mouse'bus='ps2'/>

<graphicstype='vnc'port='5910'autoport='no'listen='0.0.0.0'>

<listentype='address'address='0.0.0.0'/>

</graphics>

<video>

<modeltype='cirrus'vram='9216'heads='1'/>

<addresstype='pci'domain='0x0000'bus='0x00'slot='0x02'function='0x0'/>

</video>

<memballoonmodel='virtio'>

<addresstype='pci'domain='0x0000'bus='0x00'slot='0x04'function='0x0'/>

</memballoon>

</devices>

</domain>

</domainsnapshot>

[root@node1data]#

(4)查看当前虚拟机镜像文件

又创建了一个,快照的版本也记录在镜像文件中了。

快照配置文件在/var/lib/libvirt/qemu/snapshot/虚拟机名称/下

4.恢复虚拟机快照

(1)恢复虚拟机快照必须关闭虚拟机。

确认虚拟机是关机状态

(2)确认需要恢复的快照时间,这里恢复到1378579737

(3)执行恢复,并确认恢复版本

#virshsnapshot-revertoeltest011378579737

5.删除虚拟机快照

(1)查看虚拟机快照

#qemu-imginfotest01.qcow2

这里删除第一个快照1378579737

(2)删除快照

到此kvm虚拟机快照测试完毕。kvm虚拟化学习笔记进行到这里了,感觉到kvm虚拟化的内容真的很多。水是越来越深了。

本文转自 koumm 51CTO博客,原文链接:/koumm/1291893,如需转载请自行联系原作者

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。