标签:delete specific memory clu 解决 blog 文件 平台 strong
[root@k8s-01 ~]# virsh snapshot-create vm01-centos7 已生成域快照 1580475507 [root@k8s-01 ~]# virsh snapshot-create-as vm01-centos7 vm01-centos7-first-snap 已生成域快照 vm01-centos7-first-snap
注意:
1.快照实际上做的是虚拟机的XML配置文件,默认快照XML文件在/var/lib/libvirt/qemu/snapshot/虚拟机名/下
2.快照只支持qcow2磁盘格式的系统,若是其他格式,则需要转换——
[root@k8s-01 ~]# qemu-img info /data/images/vm01-centos7.img image: /data/images/vm01-centos7.img file format: qcow2 virtual size: 10G (10737418240 bytes) disk size: 1.2G cluster_size: 65536 Snapshot list: ID TAG VM SIZE DATE VM CLOCK 1 1580475507 0 2020-01-31 20:58:27 00:00:00.000 2 vm01-centos7-first-snap 0 2020-01-31 21:07:14 00:00:00.000 Format specific information: compat: 1.1 lazy refcounts: true
[root@k8s-01 ~]# virsh shutdown vm01-centos7 [root@k8s-01 ~]# qemu-img convert -f raw -O qcow2 /data/images/vm01-centos7.img /data/images/vm01-centos7.qcow2 -f:源镜像的格式 -O:目标镜像的格式
3.转换格式化后需要在xml配置文件中修改source file为转换后的文件。
[root@k8s-01 ~]# virsh snapshot-list vm01-centos7 名称 生成时间 状态 ------------------------------------------------------------ 1580475507 2020-01-31 20:58:27 +0800 shutoff vm01-centos7-first-snap 2020-01-31 21:07:14 +0800 shutoff
[root@k8s-01 ~]# ll /var/lib/libvirt/qemu/snapshot/vm01-centos7/ 总用量 16 -rw------- 1 root root 4629 1月 31 21:07 1580475507.xml -rw------- 1 root root 4693 1月 31 21:07 vm01-centos7-first-snap.xml
[root@k8s-01 ~]# qemu-img info /data/images/vm01-centos7.img image: /data/images/vm01-centos7.img file format: qcow2 virtual size: 10G (10737418240 bytes) disk size: 1.2G cluster_size: 65536 Snapshot list: ID TAG VM SIZE DATE VM CLOCK 1 1580475507 0 2020-01-31 20:58:27 00:00:00.000 2 vm01-centos7-first-snap 0 2020-01-31 21:07:14 00:00:00.000 Format specific information: compat: 1.1 lazy refcounts: true
提示:通过查看磁盘信息可查看该磁盘所有快照。
[root@k8s-01 ~]# virsh snapshot-current vm01-centos7 <domainsnapshot> <name>vm01-centos7-first-snap</name> <state>shutoff</state> <parent> <name>1580475507</name> </parent>
[root@k8s-01 ~]# virsh snapshot-revert vm01-centos7 1580475507 [root@k8s-01 ~]# virsh snapshot-current vm01-centos7 <domainsnapshot> <name>1580475507</name> <state>shutoff</state> <creationTime>1580475507</creationTime> <memory snapshot=‘no‘/> <disks>
提示:建议恢复虚机的时候虚机为关闭状态。
[root@k8s-01 ~]# virsh snapshot-delete vm01-centos7 vm01-centos7-first-snap 已删除域快照 vm01-centos7-first-snap
[root@k8s-01 ~]# virsh snapshot-list vm01-centos7 名称 生成时间 状态 ------------------------------------------------------------ 1580475507 2020-01-31 20:58:27 +0800 shutoff
[root@k8s-01 ~]# virsh edit vm01-centos7 …… <clock offset=‘utc‘> 修改为—— <clock offset=‘localtime‘> #虚机时间会和宿主机同步
注:
标签:delete specific memory clu 解决 blog 文件 平台 strong
原文地址:https://www.cnblogs.com/liujunjun/p/12246796.html