Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common commands in KVM

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "What are KVM common commands?" The content is simple and easy to understand, and the organization is clear. I hope it can help you solve your doubts. Let Xiaobian lead you to study and learn this article "What are KVM common commands?"

KVM is a full-featured virtualization solution on x86 hardware platforms under Linux, consisting of a loadable kernel module kvm.ko providing and virtualizing core architecture and processor specification modules. KVM allows multiple virtual machines, including Linux and Windows, to have their own hardware, including network cards, disks, and graphics adapters.

View all virtual machine states: [root@kvm7 vps] virsh list --all View specified virtual machine states: [root@kvm7 vps] virsh domstate vm01running Manually starting virtual machine: [root@kvm7 vps] virsh start vmname Manually shutting down virtual machine: [root@kvm7 vps] virsh shutdown vmname Suspend virtual machine (suspend):[root@kvm7 vps] virsh suspend vmname Resume suspended state Virtual machine: [root@kvm7 vps] virsh resume name Power-off Virtual machine: [root@kvm7 vps] virsh destroy vmname settings Boot with host (boot):[root@kvm7 vps] virsh autostart vmname Cancel boot: [root@kvm7 vps] virsh autostart --disable vmname Delete VM.xml profile [root@kvm7 vps] virsh redefine vmname Export (backup) VM profile [root@kvm7 vps] virsh dumpxml centos6 >/home/vpsbak/centos6bak.xml

Edit the virtual machine configuration file (the configuration file location is/etc/libvirt/qemu, you can edit it with vim, but it is recommended to use the commands provided by KVM to edit it)

[root@kvm7 vps] virsh edit vmname View VM disk information: [root@kvm7 vps] qemu-img info vm01.imgimage: vm01.imgfile format: qcow2virtual size: 10G (10737418240 bytes)disk size: 3.3Gcluster_size: 65536Format specific information: compat: 0.10 View disks used by a specified VM: [root@kvm7 vps] virsh domblklist vm01 Target Source---------------------------------------------------vda /home/vps/vm01.imgvdb /home/vps/data.imghda Virtual Machine Migration Host Physical Server

1. Backup virtual machine configuration files

[root@kvm6 vps] virsh dumpxml centos6 > /home/vpsbak/centos6.xml

2. Shut down, migrate configuration files and disk files. The configuration file path is/etc/libvirt/qemu.

[root@kvm6 vps] scp /home/vpsbak/centos6.xml root@192.168.0.3:/etc/libvirt/qemu/[root@kvm6 vps] scp /home/vpsdata/vps/centos6.qcow2 root@192.168.0.3:/data/vpsdata/vps

3. Activate the virtual machine configuration file

[root@kvm7 vps] virsh define/etc/libvirt/qemu/centos6.xml The above is "What are the common KVM commands?" All the contents of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report