1. snapshot management 1.1 create a snapshot
1 [[email protected] ~]# virsh snapshot-create vm03-centos6.8 2 [[email protected] ~]# virsh snapshot-create-as vm03-centos6.8 vm03-centos6.8-first-snap
Note:
1. the snapshot is actually a virtual machine xml configuration file. The default snapshot XML file is under/var/lib/libvirt/qemu/Snapshot/virtual machine name /.
2. Snapshots only support systems in qcow2 disk format. If they are in another format, they must be converted --
1 [[email protected] ~] # Qemu-IMG info/data/images/vm03-centos6.8.img # view disk format 2 Image:/data/images/vm03-centos6.8.img 3 File Format: Raw 4 [[email protected] ~] # Virsh shutdown vm03-centos6.8 5 [[email protected] ~] # Qemu-IMG convert-F raw-O qcow2/data/images/vm03-centos6.8.img/data/images/vm03-centos6.8.qcow2 6-F: source image format 7-O: Target Image Format
3. After conversion and formatting, modify the source file in the XML configuration file to the converted file.
1.2 view snapshots
1 [[email protected] ~]# virsh snapshot-list vm03-centos6.8
1 [[email protected] ~]# ll /var/lib/libvirt/qemu/snapshot/vm03-centos6.8/
1.3 view disk Information
1 [[email protected] ~]# qemu-img info /data/images/vm03-centos6.8.img
Tip: You can view all snapshots of a disk by viewing the disk information.
1.4 view the current snapshot Information
1 [[email protected] ~]# virsh snapshot-current vm03-centos6.8
1.5 restore to snapshot
1 [[email protected] ~] # Virsh snapshot-revert vm03-centos6.8 1495821260 2 [[email protected] ~] # Virsh snapshot-current vm03-centos6.8 # view verification recovery again
Tip: It is recommended that the VM be shut down when the VM is restored.
1.6 delete a snapshot
1 [[email protected] ~] # Virsh snapshot-delete vm03-centos6.8 vm03-centos6.8-first-snap 2 [[email protected] ~] # Virsh snapshot-list vm03-centos6.8 # view verification again
2. VM time management 2.1 modify VM time Configuration
1 [[email protected] ~] # Virsh edit vm03-centos6.8 2 ...... 3 <clock offset = 'utc'> 4 to -- 5 <clock offset = 'localtime'> # the VM time is synchronized with the host machine.
Note:
- In a virtualized environment, virtual machines slow down during a long period of operation. The common practice is to configure ntpdate to schedule time synchronization tasks with the time server.
- Slow VM time is a common problem for all virtualization platforms.
- The final solution of the solution time is to configure the time server in the production environment. Both the KVM virtualization server and the KVM server need to configure scheduled tasks for time synchronization.
007. kvm vm time-Snapshot Management