In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
KVM Management of KVM Virtualization (2)
KVM management operation
Virsh is a common management tool for kvm virtual machines.
1. Virsh command format:
Virsh parameter kvm virtual machine name
2. Common parameters of virsh:
View running KVM virtual machines
Virsh list
View all KVM virtual machines
Virsh list-all
Turn on the KVM virtual machine
Virsh start centos7
Shut down the KVM virtual machine
Virsh shutdown centos7
Unplug the power supply and turn it off (forced shutdown)
Virsh destroy centos7
Export configuration
Virsh dumpxml centos7
# Delete configuration
Virsh undefine centos7
Import configuration
Virsh define centos7
Modify configuration
Virsh edit centos7
Rename the KVM virtual machine (not supported in earlier versions)
Virsh dormrename centos7
Suspend KVM virtual machine
Virsh suspend centos7
Restore (unsuspend) the KVM virtual machine
Virsh resume centos7
Boot the KVM virtual machine automatically
Virsh autostart centos7
Turn off the boot and automatically start the KVM virtual machine
Virsh autostart-disable centos7
Query the KVM port number of the VNC virtual machine
Virsh vncdisplay centos7
View CPU information of a virtual machine
Virsh nodeinfo
Start the default network
Virsh net-start default
Self-starting the default network
Virsh net-autostart default
Disk format conversion of KVM virtual machine
Two commonly used disk formats for KVM virtual machines
Raw: bare format, takes up a lot of space (directly takes up physical hard disk), is not suitable for remote transmission, does not support snapshot function, but has fast writing and good performance.
Qcow2:cow (copy on write) takes up less space (how many disks are used), is suitable for transmission, supports compression, snapshots, mirroring, and has a slightly worse performance than raw.
Disk format conversion
Common commands of qemu-img
/ / create a virtual disk
Qemu-img create test.raw 10G
Qemu-img create-f qcow2 test.qcow2 10G
/ / View virtual disk information
Qemu-img info test.raw
/ / resize the capacity of virtual disk
Qemu-img resize test.raw + 5G
/ / disk format conversion (convert test.raw to centos7.qcow2)
Qemu-img convert-f raw-O qcow2 test.raw centos7.qcow2
Note: the virtual machine must be turned off for further disk conversion
Parameter description:
Convert converts disk files to files in the specified format
-f specifies the file format of the file to be converted
-O specify the target format to be converted after the conversion is completed, a new target image file will be produced and the original file will still be saved.
Snapshot Management of KVM Virtual Machine
1. Check the disk format, if the raw format needs to be converted to qcow2 format
/ / create a snapshot
Virsh snapshot-create centos7
/ / check the latest snapshot version of the current virtual machine
[root@kvm-node1 ~] # virsh snapshot-current centos7 | less
/ / Snapshot xml file storage path
[root@kvm-node1 ~] # ls / var/lib/libvirt/qemu/snapshot/centos7/
/ / View snapshots (can view a series of numbers, restore and delete by numbers)
Virsh snapshot-list centos7
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.