In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail the example analysis of Kvm virtual machine cloning and adding disks. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Clone a virtual machine
There is already a virtual machine ly1, and now you need a new virtual machine to copy directly from ly1.
First close the running ly1
Virsh # destroy ly1Domain ly1 destroyed
And then start cloning.
# virt-clone-o ly1-n pwc1-f / vg0_lv2/pwc1.imgAllocating 'pwc1.img' | 200 GB 00:52 Clone 'pwc1' created successfully.
Parameter description:
-O already have a machine
-n New virtual machine name
-f specify the location and name of the image file
After cloning, check the status of the virtual machine
# virsh list-- all Id Name State--- 13 ly2 running-ly1 shut off-pwc1 shut off
The cloned virtual machine is still in the off state, starts and modifies its ip address through the vnc connection, and the new virtual machine is successfully cloned.
Add disks to the kvm virtual machine
1. View the storage of virtual machine pwc1
Virsh # domblklist pwc1Target Source---hda / vg0_lv2/pwc1.imghdc-
2. Create a disk file
# qemu-img create-f qcow2 pwc1_1.qcow2 50GFormatting 'pwc1_1.qcow2', fmt=qcow2 size=53687091200 encryption=off cluster_size=65536
3. View the newly created disk file
# qemu-img info pwc1_1.qcow2image: pwc1_1.qcow2file format: qcow2virtual size: 50G (53687091200 bytes) disk size: 136Kcluster_size: 65536
4. Add a new disk file for the virtual machine
# virsh attach-disk pwc1 / vg0_lv2/pwc1_1.qcow2 vdb-cache=none-subdriver=qcow2Disk attached successfully
5. Check that the new disk has been recognized by the virtual machine.
# virsh domblklist pwc1Target Source---hda / vg0_lv2/pwc1.imghdc-vdb / vg0_lv2/pwc1_1.qcow2
6. You can connect to vnc and check the disk
You can see that a 50g disk / dev/vda has been added
Note: for the virtual machine, the new disk is / dev/vda, but for the host to use virsh to view, it is now the name specified by the host vdb
This is the end of the article on "sample analysis of Kvm virtual machine cloning and adding disks". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
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.