linux系统的虚拟机快照

[root@foundation2 libvirt]# cd /var/lib/libvirt/images/                                              #切换到硬盘位置
[root@foundation2 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
[root@foundation2 images]# rm -fr node1.qcow2

[root@foundation2 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

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



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                     #删除虚拟机



[root@foundation2 images]# cd /var/lib/libvirt/images/
[root@foundation2 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
[root@foundation2 images]#  mv wwy.qcow2 /mnt/
[root@foundation2 images]# cd /etc/libvirt/qemu/
[root@foundation2 qemu]# ls
desktop.xml  ls  networks  server.xml  wwy.xml
[root@foundation2 qemu]# mv wwy.xml /mnt/
[root@foundation2 qemu]# cd /mnt/
[root@foundation2 mnt]# ls
hahaha.qcow2  kaixin.qcow2  wwy.qcow2
hahaha.xml    vm_create.sh  wwy.xml
[root@foundation2 mnt]# mv wwy.qcow2 /var/lib/libvirt/images
[root@foundation2 mnt]# ls
hahaha.qcow2  hahaha.xml  kaixin.qcow2  vm_create.sh  wwy.xml
[root@foundation2 mnt]# virsh create wwy.xml   #只能打开一次
Domain wwy created from wwy.xml

[root@foundation2 mnt]# virsh define wwy.xml   #永久打开
Domain wwy defined from wwy.xml

[root@foundation2 mnt]# virsh undefine wwy     #永久关闭
Domain wwy has been undefined









  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值