To implement the conversion of a VirtualBox virtual machine to a KVM virtual machine

Source: Internet
Author: User

It turned out that using the VirtualBox hypervisor (VMM) to build virtual machines on the desktop was installed on different operating systems, and now

Research KVM under Linux, can you convert an already established VirtualBox virtual client (guest) to a KVM virtual machine? After search

Information, really can. The following steps are described:

1. Convert the virtual Disk file (VDI) of the VirtualBox virtual machine to a file in RAW format

This step uses VirtualBox's command-line tool vboxmanage, which is useful for generating virtual machines by scripting.

It provides more powerful features than the VirtualBox graphics configuration provides. The specific commands are as follows:

Vboxmanage Clonehd--format Raw Centos.vdi centos.img

Description: Converts a virtual disk file named Centos.vdi to a virtual disk file in RAW format, which can be said to be a raw file

A bridge between different format virtual disk files can be converted to this format, and then converted to

Other destination formats. When the conversion is complete, the resulting raw format file size is the size specified when the virtual machine is configured, and the actual VDI file occupies only

The actual size of the application, such as configuration, although specified as 20G, but after the installation of the operating system and related software, may only need 8G, then the actual

The virtual Disk file (VDI format) only takes up 8G, but after the conversion with the above command, the converted file size is the virtual

When you specify the size of the disk space, here is 20G, so you need to check the disk space before conversion is sufficient.

Command parameters: Clonehd--Clone virtual disk

--format Raw--Specify conversion format

Clone this is used in virtualization technology, such as backup, migration, and so many are implemented through this technology.

2. Convert the converted raw format file to the Qcow2 format file used by KVM

This step is implemented using the Qemu-img tool, which, if not on the machine, can be installed via RPM or Yum with the package named Qemu-img.

Qemu-img is a QEMU command-line tool dedicated to virtual disk image files.

The specific commands are as follows:

Qemu-img convert-f Raw Centos.img-o qcow2 centos.qcow2

Parameter description: Convert converts a disk file to a file of the specified format

-f Specifies the file format in which the file needs to be converted

-o Specifies the destination format to convert

Once the conversion is complete, a new target image file is produced and the original file is still saved.

3. Use the QEMU-KVM command to start the virtual machine based on the converted virtual disk image

After the KVM supported file format is generated, you can use QEMU-KVM to start the virtual machine based on the converted disk file, the syntax

As follows:

Qemu-kvm-m 1024-m pc-smp 2-hda/opt/images/centos.qcow2-boot c-name centos \

-K en-US vnc:0-usb-usbdevice tablet

Once started, a separate QEMU-KVM process will be produced, using the VNC tool to connect to this virtual machine, in this case the VNC port is

5900, after the connection, you can do a variety of operations in the client.

Parameter description:-m 1024 Specify memory size

-M PC true machine type, here for Rhel 5.4.0 pc

-SMP simulation of symmetric multiprocessor systems using 2 virtual CPUs

-hda specifying the virtual disk file name

-BOOT specifies that the boot device C is the hard drive and D is the optical drive

-name specifying the virtual machine name

-K Specify keyboard layout

VNC:0 Specifies the VNC connection port, the final port is the following number +5900

-USB Make USB devices effective

-usbdevice tablet joins a device, a tablet is a pointing device that uses absolute coordinates, such as a mouse

4. Other instructions

A virtual machine built using the third step is only temporary, and this virtual machine does not exist when the process is shut down. You can manually compile a

Configuration files, the protection of the various parameters of the virtual machine in the/etc/libvirt/qemu directory, so that can be managed by Virsh, you can

Easy to start and close. A configuration file can use a configuration file that already has a virtual machine as a template.

In a virtual machine built with VirtualBox, if the VirtualBox vboxguestadditions is installed (primarily for controlling the mouse

Capture and so on), you need to uninstall the virtual machine first, so KVM does not support it.

http://blog.csdn.net/starshine/article/details/7032316

To implement the conversion of a VirtualBox virtual machine to a KVM virtual machine

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.