在线精品99_中国九九盗摄偷拍偷看_91免费版在线观看_91.app_91高清视频在线_99热最新网站

KVM虚拟机快照管理的示例分析

139次阅读
没有评论

共计 4520 个字符,预计需要花费 12 分钟才能阅读完成。

这篇文章主要介绍 KVM 虚拟机快照管理的示例分析,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

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

查看磁盘格式并转换:

[root@e3 images]# qemu-img info centos6.5.img 
image: kvm003.img
file format: raw # 可以看出默认 kvm 使用磁盘格式为 RAW
virtual size: 20G (21474836480 bytes)
disk size: 1.8G

关闭虚拟机并转换磁盘

[root@e3 images]# virsh list --all
 Id  名称   状态
----------------------------------------------------
 29 centos6.6 running
 - centos6.5  关闭
 - kvm001  关闭
 - kvm002  关闭
 - kvm003  关闭
 - template  关闭 

转换

[root@e3 images]# qemu-img convert -f raw -O qcow2 kvm003.img kvm003.qcow2 #- f 指定源格式  - O 指定转换格式
[root@e3 images]# qemu-img info centos6.5.qcow2
[root@e3 images]# qemu-img info centos6.5.qcow2 
image: centos6.5.qcow2
file format: qcow2 # 转换成功
virtual size: 20G (21474836480 bytes)
disk size: 1.4G
cluster_size: 65536
Format specific information:
 compat: 1.1
 lazy refcounts: false

修改虚拟机配置文件

[root@e3 images]# virsh edit centos6.5
 devices 
  emulator /usr/libexec/qemu-kvm /emulator 
  disk type= file  device= disk 
  driver name= qemu  type= qcow2  cache= none /  # 修改
  source file= /data/kvm/images/centos6.5.qcow2 /  # 修改
  target dev= vda  bus= virtio / 
  address type= pci  domain= 0x0000  bus= 0x00  slot= 0x04  function= 0x0 / 
  /disk

对虚拟机进行快照

[root@e3 images]# virsh snapshot-create centos6.5
已生成域快照  1421829141

查看快照

[root@e3 images]# virsh snapshot-list centos6.5
  名称   生成时间   状态
------------------------------------------------------------
 1421829141 2015-01-21 16:32:21 +0800 shutoff

查看当前的虚拟机快照版本

[root@e3 images]# virsh snapshot-current centos6.5
 domainsnapshot 
  name 1421829141 /name  # 这
  state shutoff /state 
  creationTime 1421829141 /creationTime 
  memory snapshot= no / 
  disks 
  disk name= vda  snapshot= internal / 
  /disks 
  domain type= kvm 
  name centos6.5 /name 
  uuid 34f5ab44-7800-4bc9-a9c1-5227460cf1fa /uuid 
  memory unit= KiB 524288 /memory 
  currentMemory unit= KiB 524288 /currentMemory

查看虚拟机快照文件

[root@e3 images]# virsh snapshot-create centos6.5
已生成域快照  1421829551
[root@e3 images]# virsh snapshot-list centos6.5
  名称   生成时间   状态
------------------------------------------------------------
 1421829141 2015-01-21 16:32:21 +0800 shutoff
 1421829551 2015-01-21 16:39:11 +0800 shutoff
#因为 virsh  命令由 libvirt-client 提供所以 rpm -ql libvirt-client  可以看到快照文件存储在
/var/lib/libvirt
[root@e3 images]# rpm -ql libvirt-client
[root@e3 images]# cd /var/lib/libvirt/qemu/
[root@e3 qemu]# ls
capabilities.monitor.sock centos6.6.monitor channel dump save snapshot
[root@e3 qemu]# ll
总用量  16
srwxr-xr-x. 1 qemu qemu 0 1 月  19 10:15 capabilities.monitor.sock
srwxr-xr-x. 1 qemu qemu 0 1 月  21 11:40 centos6.6.monitor
drwxr-x---. 3 qemu qemu 4096 1 月  6 06:32 channel
drwxr-xr-x. 2 root root 4096 1 月  14 10:05 dump
drwxr-xr-x. 2 qemu qemu 4096 1 月  14 10:05 save
drwxr-xr-x. 3 qemu qemu 4096 1 月  21 16:32 snapshot
[root@e3 qemu]# ll
总用量  16
srwxr-xr-x. 1 qemu qemu 0 1 月  19 10:15 capabilities.monitor.sock
srwxr-xr-x. 1 qemu qemu 0 1 月  21 11:40 centos6.6.monitor
drwxr-x---. 3 qemu qemu 4096 1 月  6 06:32 channel
drwxr-xr-x. 2 root root 4096 1 月  14 10:05 dump
drwxr-xr-x. 2 qemu qemu 4096 1 月  14 10:05 save
drwxr-xr-x. 3 qemu qemu 4096 1 月  21 16:32 snapshot
[root@e3 qemu]# cd snapshot/
[root@e3 snapshot]# ll
总用量  4
drwxr-xr-x. 2 root root 4096 1 月  21 16:39 centos6.5
[root@e3 snapshot]# cd centos6.5/
[root@e3 centos6.5]# ll
总用量  8
-rw-------. 1 root root 2082 1 月  21 16:39 1421829141.xml # 存储文件
-rw-------. 1 root root 2133 1 月  21 16:39 1421829551.xml # 存储文件 

恢复虚拟机快照 #虚拟机必须是关闭状态

[root@e3 images]# virsh list --all
 Id  名称   状态
----------------------------------------------------
 29 centos6.6 running
 33 centos6.5 running
 - kvm001  关闭
 - kvm002  关闭
 - kvm003  关闭
 - template  关闭
[root@e3 images]# virsh shutdown centos6.5 # 关闭
域  centos6.5  被关闭
[root@e3 images]# virsh destroy centos6.5 # 关闭不了强制关闭
域  centos6.5  被删除
[root@e3 images]# virsh list --all # 查看状态
 Id  名称   状态
----------------------------------------------------
 29 centos6.6 running
 - centos6.5  关闭
 - kvm001  关闭
 - kvm002  关闭
 - kvm003  关闭
 - template  关闭
[root@e3 images]# virsh domstate centos6.5 # 确认关闭
[root@e3 images]# virsh snapshot-list centos6.5 # 查看快照
  名称   生成时间   状态
------------------------------------------------------------
 1421829141 2015-01-21 16:32:21 +0800 shutoff
 1421829551 2015-01-21 16:39:11 +0800 shutoff
[root@e3 images]# virsh snapshot-current centos6.5 # 查看当前使用那个快照
 domainsnapshot 
  name 1421829551 /name  #
  state shutoff /state 
  parent 
[root@e3 images]# virsh snapshot-revert centos6.5 1421829141 # 恢复
[root@e3 images]# virsh snapshot-current centos6.5
 domainsnapshot 
  name 1421829141 /name  # 恢复成功
  state shutoff /state 
  creationTime 1421829141 /creationTime 
  memory snapshot= no / 
  disks 
  disk name= vda  snapshot= internal /

以上是“KVM 虚拟机快照管理的示例分析”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注丸趣 TV 行业资讯频道!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-08-16发表,共计4520字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)
主站蜘蛛池模板: 麻豆精品久久久一区二区 | 亚洲精品久久区二区三区蜜桃臀 | 亚洲一本大道无码av天堂 | 久久这里只有精品8 | 欧美性生交活xxxxxdddd | 亚洲欧洲精品一区二区三区 | 国内自拍视频在线观看 | 国产精品视频久久久久 | 把腿张开老子臊烂你多p视频 | 妺妺窝人体色www聚色窝 | 国产亚洲精品日韩综合网 | 欧美 国产 综合 欧美 视频 | 免费一级黄色大片 | 两个人看的www神马视频 | 国产精品短视频 | 在线天堂网 | 日本中文一二区有码在线观看 | 亚洲日本欧美日韩高观看 | 久草在线免费电影 | 青草国产精品久久久久久 | 亚洲精品乱码久久久久久日本蜜臀 | 成人精品免费网站 | 久久综合给合久久国产免费 | 不卡中文字幕在线观看 | 丰满人妻熟妇乱又伦精品软件 | 一级黄色毛片免费看 | 一卡二卡三卡视频 | 成人网18免费韩国 | 国产丝袜精品丝袜一区二区三区 | 美女视频黄a视频全免费网站色窝 | 亚洲精品天天影视综合网 | 伊人久久影院大香线蕉 | 日韩一级特黄毛片在线看 | 欧美日韩精品一区二区三区四区 | avav在线看| 黑人巨茎大战俄罗斯美女 | 亚洲av无码第一区二区三区 | 无码一区二区三区视频 | 日韩超碰人人爽人人做人人添 | 综合精品一区 | 亚洲人人精品 |