Resolving the problem of VirtualBox nested virtualized KVM sub-boot very slow

Source: Internet
Author: User
Prior to the VirtualBox nested installation of KVM virtualization, the use of VNC viewer to install the child, the speed is OK, but the installation system after the start of the machine is very slow. The login interface takes approximately twenty or thirty minutes from boot to appearance. The adjustment has been adjusted, but also to upgrade the VirtualBox to the latest 5.0, or not. It was later found that if you use the default virtual disk format raw, the system allocates all of the specified disk sizes at once, while using QCOW2, the virtual disk size is dynamically allocated. I converted the existing virtual disks one at a time:

Qemu-image convert-f Raw-o Qcow2/kvm/vm/vm1.img/kvm/vm/vm1.qcow2

Then modify the configuration file:

Virsh Edit CentOS

<disk type= ' file ' device= ' disk ' >
<driver name= ' qemu ' type= ' qcow2 ' cache= ' None '/>
<source file= '/kvm/vm/vm1.qcow2 '/>
<target dev= ' hda ' bus= ' ide '/>
</disk>

Restart LIBVIRTD
Service LIBVIRTD Restart
Then start the virtual machine
Virsh start CentOS

After monitoring found that the start-up time spent 10 minutes, less than the previous half of the time, but still a little slow

Today look at Ming elder brother sent a more detailed KVM post, the last section of the clone virtual machine configuration file has a modified disk interface is not the IDE but virtio. Suddenly the brain is a flash, will not be the interface of the problem caused by slow start. Then I made the following modifications:
Virsh Edit CentOS
"CentOS" is the name of the virtual machine

<disk type= ' file ' device= ' disk ' >
<driver name= ' qemu ' type= ' qcow2 ' cache= ' None '/>
<source file= '/kvm/vm/vm1.qcow2 '/>
<target dev= ' Vda ' bus= ' Virtio '/>
<address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' ' slot= ' 0x07 ' ' function= ', ' 0x0 '
</disk>
At that time, the countdown is two lines, I was deleted, this line is the subsystem started when the system automatically write. This shows that when you modify the KVM hardware configuration, if the address of the line will not write, you can directly delete the line, the system will allocate relevant information to the device.
Personality after the Save exit

Restart LIBVIRTD
Service LIBVIRTD Restart
Then start the virtual machine
Virsh start CentOS

I monitored the boot, this time only 4 points more, the following figure:


To sum up, if you are using virtual box to do nested virtualization experiments in a VM, after you have installed the system with the default configuration, you need to do the following two steps:
1, convert an existing virtual disk from RAW format to QCOW2 format
2, modify the virtual disk interface in the configuration file to modify the IDE to Virtio
For more information on Linux, please visit: http://www.aminglinux.com/bbs/?fromuid=4297

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.