KVM Virtual machine Windows system adds hard drives

Source: Internet
Author: User

Original: http://www.ilanni.com/?p=6211

The previous article describes how to add a hard disk to a Linux system, and this time we'll cover steps for adding Windows systems.

In fact, Linux and Windows add the same method of hard disk, but also can be added through the command line and modify the configuration file.

Here's how to add a hard disk by editing the virtual machine configuration file with the Virsh Edit command.

Note Windows system add hard disk requires a sub-drive interface, IDE interface and Virtio interface.

First create a new hard disk, using the qemu-img Create command, as follows:

Qemu-img create-f qcow2 testwin.img 10G



To close the virtual machine, use the Shutdown command, as follows:

List–all

Shutdown server2008



Now to edit the virtual machine server2008 configuration file, use the Edit command, as follows:

Edit server2008



Let's first add the IDE interface's hard disk and add the following code:

<disk type= ' file ' device= ' disk ' >

<driver name= ' qemu ' type= ' qcow2 ' cache= ' None '/>

<source file= '/vhostdisk/testwin.img '/>

<target dev= ' HDB ' bus= ' ide '/>

</disk>



Note that the hard drive interface we use here is the IDE interface, and the hard disk name is HDB, so the system can be directly identified after the addition is complete.

When you are finished editing, save.

The configuration file is reloaded at this time, as follows:

Virsh Define Server2008.xml

Then start the virtual machine server2008, using the Start command, as follows:

Start server2008



Now log in to the virtual machine server2008 to see the new plus drive.


Through, we can see the newly added hard disk, the system has been fully recognized, we just have to format, and then the line partition can be used. Such as:



The above is the interface to add the hard disk is the IDE, then we now test to add the Virtio interface of the hard disk.

New Hard disk:

Qemu-img create-f qcow2 testwinvirtio.img 10G

QEMU-IMG Info testwinvirtio.img



Edit the virtual machine server2008 configuration file and add the following code:

<disk type= ' file ' device= ' disk ' >

<driver name= ' qemu ' type= ' qcow2 ' cache= ' None '/>

<source file= '/vhostdisk/testwinvirtio.img '/>

<target dev= ' Vda ' bus= ' Virtio '/>

</disk>



Then start the virtual machine server2008 to see the actual situation.

Through, we can see that the hard drive that was just added was not found. But we will find in Device Manager a new device, such as:



Why would that be? This is because KVM by default, the Windows system is not installed Virtio drivers. We need to download and install the Virtio driver separately, we can download it on the following website:

http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/

Https://www.linuxwind.org/html/kvm-windows-2008-virtion-driver.html

Now I upload the downloaded driver file to the virtual machine server2008, and then install the driver. As follows:







After the driver is installed, we can see the newly added memory in the Device Manager, such as:



While the newly added hard drive, we can also see, as follows:



The above is related to the configuration of the new HDD for the KVM virtual machine Windows system.

KVM Virtual machine Windows system adds hard drives

Related Article

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.