linux系统的虚拟机快照

[[email protected] libvirt]# cd /var/lib/libvirt/images/                                              #切换到硬盘位置
[[email protected] images]# ls                                                                                #查看想要快照的母盘
hahaha.qcow2             rh124-desktop.xml       test.qcow2
kaixin.qcow2             rh124-server-vda.ovl    westos-1.qcow2
node1.qcow2              rh124-server-vda.qcow2  westos-2.qcow2
rh124-desktop-vda.ovl    rh124-server-vdb.ovl    westos2.qcow2
rh124-desktop-vda.qcow2  rh124-server-vdb.qcow2  westos.qcow2
rh124-desktop-vdb.ovl    rh124-server.xml
rh124-desktop-vdb.qcow2  rhel7.0.qcow2
[[email protected] images]# rm -fr node1.qcow2

[[email protected] images]# qemu-img create -f qcow2 -b kaixin.qcow2 node1.qcow2

                                       # -f是创建,-b是备份, kaixin.qcow2是母盘名称,node1.qcow2是快照名称

Formatting 'node1.qcow2', fmt=qcow2 size=9663676416 backing_file='kaixin.qcow2' encryption=off cluster_size=65536 lazy_refcounts=off

[[email protected] images]# virt-manager               #把快照导入虚拟机,双击带灯泡的电脑符号,选择import...

linux系统的虚拟机快照



html            #超文本标记语言,标准通用标记语言下的一个应用。
“超文本”就是指页面内可以包含图片、链接,甚至音乐、程序等非文字元素  
xml可扩展标记语言(做数据封装)

virsh list -all                                       #显示
virsh start desktop                           #表示可以开启一个
virt-viewr desktop                            #显示虚拟机
virsh shoutdown desktop                #正常关闭虚拟机
virsh destroy desktop                      #强制关闭虚拟机
virsh create desktop                        #一次性打开,关闭后不存在
virsh define desktop                        #永久建立
virsh undifine desktop                     #删除虚拟机



[[email protected] images]# cd /var/lib/libvirt/images/
[[email protected] images]# ls
rh124-desktop-vda.ovl    rh124-server-vda.qcow2  westos-1.qcow2
rh124-desktop-vda.qcow2  rh124-server-vdb.ovl    westos-2.qcow2
rh124-desktop-vdb.ovl    rh124-server-vdb.qcow2  westos2.qcow2
rh124-desktop-vdb.qcow2  rh124-server.xml        westos.qcow2
rh124-desktop.xml        rhel7.0.qcow2           wwy.qcow2
rh124-server-vda.ovl     test.qcow2
[[email protected] images]#  mv wwy.qcow2 /mnt/
[[email protected] images]# cd /etc/libvirt/qemu/
[[email protected] qemu]# ls
desktop.xml  ls  networks  server.xml  wwy.xml
[[email protected] qemu]# mv wwy.xml /mnt/
[[email protected] qemu]# cd /mnt/
[[email protected] mnt]# ls
hahaha.qcow2  kaixin.qcow2  wwy.qcow2
hahaha.xml    vm_create.sh  wwy.xml
[[email protected] mnt]# mv wwy.qcow2 /var/lib/libvirt/images
[[email protected] mnt]# ls
hahaha.qcow2  hahaha.xml  kaixin.qcow2  vm_create.sh  wwy.xml
[[email protected] mnt]# virsh create wwy.xml   #只能打开一次
Domain wwy created from wwy.xml

[[email protected] mnt]# virsh define wwy.xml   #永久打开
Domain wwy defined from wwy.xml

[[email protected] mnt]# virsh undefine wwy     #永久关闭
Domain wwy has been undefined