I am a danish programmer living in Bangkok.
Read more about me @ rasmus.rummel.dk.
Webmodelling Home > Ubuntu KVM Virtualization - how to
Do good

Ubuntu KVM Virtualization how-to

Updated Jul 2013. This tutorial is a step-by-step guide how to get KVM virtualization to work on Ubuntu server.

If you do not yet have an installed Ubuntu server, please see How to install Ubuntu. From now on I assume you already have an installed Ubuntu server and are ready to start virtualization.

  1. Install virtualization relevant packages
  2. Configure networking for virtual machines
  3. Install a virtual machine - not as easy as VirtualBox or Hyper-V role.

Appendixes :

Relevant links :


1 : Install virtualization relevant packages

  1. Reboot your machine and enter the BIOS and find the virtualization parameter and be sure virtualization is enabled.
  2. Then your Ubuntu starts up either login as root or switch user to root (shell> su root).
  3. shell> apt-get install cpu-checker : this makes the next command, kvm-ok, possible.
  4. shell> kvm-ok : will print a message whether your CPU supports KVM. If KVM is not supported you can still create virtual machines, but they will run slower, allegedly too slow for production purposes.
  5. shell> uname -m : if you see x86_64 then your kernel is 64 bit and you can create VM's with more than 2 GB RAM. If you see eg. i386, i486, i586 or i686, then your kernel is 32 bit and you can maximum allegate 2 GB RAM to your VM's
  6. shell> apt-get install virtinst : will install virt-install, our tool of choice for installing virtual machines later (earlier I think the package was named python-virtinst).
  7. shell> apt-get install ubuntu-vm-builder : a more efficient alternative to virt-install if you want to host only Ubuntu as guest OS'es (this tutorial will not use ubuntu-vm-builder).
  8. shell> apt-get install virt-viewer : virt-viewer is used to interface with the virtual machine, this is needed to give the virtual machine a static IP so that we can access the virtual machine using either SSH for a Linux VM or RDP for a Windows VM (to complicate things further : virt-viewer is a GUI program and therefore needs a windows manager, therefore even while we install virt-viewer on the Ubuntu server, it must be executed from either a Linux or a Windows desktop not directly on the Ubuntu server).
  9. shell> apt-get install qemu-kvm libvirt-bin : the virtualization libraries.
  10. shell> apt-get install bridge-utils : used to configure the Ubuntu host server networking to allow the outer world access to the virtual machines (the outer world will not even know that the virtual machines are virtual).

2 : Configure networking for virtual machines

Default a virtual machine will have access to the outer world, but the outer world will not have access to the virtual machine. To expose the VM for the outer world so it gives mening to host eg. a web server, it is necessary to install a network bridge on the host OS.

  1. If you want to create the bridge as another user than root, then you need to set cap_net_admin capabilities for that user : (if you run as root, then you can skip this first step)
    1. shell> apt-get install libcap2-bin : this package is necessary to run setcap below.
    2. shell> setcap cap_net_admin=ei /usr/bin/qemu-system-x86_64 :
    3. shell> nano /etc/security/capability.conf : load the capability configuration file in the nano editor
    4. Add the following line to the capability.conf file :
      • cap_net_admin YOUR_USERNAME
    5. Save the file (ctrl+x and then y)
    6. logout and then login with the above user (if you are already logged in as the above user, you still need to logout and login, so the user are appended the cap_net_admin capability)
  2. nano /etc/network/interfaces : load the interfaces configuration file in the nano editor.
  3. The default network configuration
  4. Create a network bridge : (more about bridge-utils options)
    1. Edit the following lines in the /etc/network/interfaces file :
      • iface eth0 inet dhcp should change to iface eth0 inet manual : this will avoid eth0 to bind.
    2. Add the following lines to the /etc/network/interfaces file :
      • auto br0 : automatically bring up the br0 interface on boot.
      • iface br0 inet static : br0 interface should bind a static IP
      • address 192.168.1.25 : IP of your Ubuntu host server, you should choose an IP that fits your network.
      • network 192.168.1.0 : network address.
      • netmask 255.255.255.0 : a standard 24 bit network.
      • broadcast 192.168.1.255 : .255 is standard for broadcast.
      • gateway 192.168.1.254 : or whatever the address of your router
      • bridge_ports eth0 : add the eth0 interface to the bridge (actually there may be problems if eth0 is not the device with the lowest MAC address, in which case you may need to specify the MAC address as well)
      • bridge_stp off : disable the STP (Spanning Tree Protocol) since this is the only bridge.
      • bridge_fd 0 : set FD (Forward Delay) to zero (since STP is disabled there is no need for a delay for the bridge to discover other bridges or loops).
      • bridge_maxwait 0 : no need to wait for the bridge ports (here eth0) to get in forward state.
    3. The finished result.
    4. press ctrl+x and then y to exit nano and save your changes to /etc/network/interfaces.
    5. shell> /etc/init.d/networking restart : restart all networking.
    6. shell> ifconfig -a : confirm the bridge exists and that the hardware address is the same for br0 & eth0.
  5. Disable netfilter on the bride : Under construction

3 : Install a virtual machine

On the Ubuntu host server created above, I will install 2 virtual machines, one hosting a Windows server 2008r2 and the other hosting another Ubuntu server. Here is the server result schema :

Server Machine VM name Domain IP Function Install method
Ubuntu server 11.10 physical n/a s1 192.168.1.25 VM host already installed
Windows 2008r2 virtual win2008r2 test 192.168.1.55 host asp.net remote from windows desktop
Ubuntu server 11.10 virtual php5.2 vs1 (Virtual Shared 1) 192.168.1.56 host legacy php remote from ubuntu desktop

Virtual Machines can be created using either :

  • ubuntu-vm-builder : can create only virtual machines hosting Ubuntu guest OS'es. Likely the best tool if you want only Ubuntu guest OS'es.
  • virt-install : can create virtual machines hosting a wide range of guest OS'es - the tool I am going to demonstrate here

Lets get started :

  1. Create an appropriate directory structure :
    1. shell> mkdir /var/VMs; mkdir /var/VMs/ISOs; mkdir /var/VMs/VHDs : create a suitable folder structure.
    2. shell> cd /var/VMs : change directory to /var/VMs.
  2. Copy your guest OS isos to /var/VMs/ISOs (eg. your ubuntu-11.10-server-amd64.iso file and if you have a windows server 2008r2 iso, then also that file).
  3. Write a virt-install wrapper file named vminstall.sh (or download mine, which is a better one)
    1. shell> nano vminstall.sh : start the nano editor to create the virt-install wrapper file, here called vminstall.sh.
    2. Insert the following 3 lines :
      • #!/bin/bash : for a file to execute it must start with #!/bin/bash
      • #virt-install --name php5.2 --file /var/VMs/VHDs/php5.2 --vnc --cdrom /var/VMs/ISOs/ubuntu-11.10-server-amd64.iso --ram 3072 --connect qemu:///system --file-size 10 --nonsparse --network bridge:br0 --os-type=linux --os-variant=ubuntuoneiric
      • #virt-install --name win2008r2 --file /var/VMs/VHDs/win2008r2 --cdrom /var/VMs/ISOs/Win2008r2all.iso --ram 3072 --connect qemu:///system --file-size 50 --nonsparse --network bridge:br0 --os-type=windows --os-variant=win2k8
      Note that the 2 last lines are both commented out (using #) - if you execute vminstall.sh now, nothing will happen.
  4. Save vminstall.sh (press ctrl+x and then y), you should be back at the prompt
  5. shell> ls -l : confirm that vminstall.sh have been saved.

It is very important to understand that after you have created a virtual machine, you need to boot the virtual machine on an ISO file to install an operating system. That ISO installer is graphical and unless you install x-windows and a windows manager on your Ubuntu host server, eg. in the form of Ubuntu desktop, then you cannot interact with the VM OS installer from a local console. While it is possible to execute virt-install from a local console and then use a graphical remote console (eg. an Ubuntu desktop or a Windows desktop) to connect to the VM OS installer, I instead like to execute the whole virt-install remote.

Below I demonstrate installing a VM & guest OS from 2 different remote consoles : (it does not matter which console installs what guest OS)

  1. Remote from a Windows desktop (the guest OS will be Windows server 2008r2)
  2. Remote from an Ubuntu desktop (the guest OS will be Ubuntu server 11.10)

Execute virt-install remote from a Windows desktop

  1. Download Putty. No need to install, Putty starts right away from the executable.
  2. Download Xming and install it (since the Ubuntu installer is graphical, you need a way to display X graphics on Windows - Xming is an X server for Windows).
  3. Start Xming and you should be able to see Xming in the windows taskbar notification area.
  4. Start Putty by double clicking the executable.
    • Insert the IP address of the Ubuntu host server.
    • Enable the X forwarding (X graphics will now be sent through Putty to Xming).
    • Press the Open button and you should get a terminal prompt.
    • Login as the root user or another admin user.
  5. shell> cd /var/VMs : change directory to /var/VMs
  6. shell> nano vminstall.sh : open vminstall.sh in nano and uncomment the win2008r2 line (be sure the php5.2 line is commented). Save and exit (ctrl+x and then y)
  7. shell> ./vminstall.sh : execute the vminstall file and follow the progress.
  8. Both the VM (Virtual Machine) and the VHD (Virtual Hard Drive) have been created and virt-install automatically boot on the specified iso file and loads virt-viewer to connect to the VM console, so you can interact with the installer.
  9. The new VM have booted on the Windows 2008r2 installer.
    If you cannot interact with virt-viewer, you may need to refresh Xming :
    1. Default Xming root window is hidden, right click the Xming icon and then deselect "Hide Root Window" in the context menu.
    2. Your desktop is now hidden by the Xming root window. Use Alt+Tab to activate another window and then again right click the Xming icon and this time select "Hide Root Window" in the context menu. If you had problems interacting with virt-viewer, it should be solved now.
  10. Since windows installer needs to restart but cannot, virt-install will report an error ERROR operation failed: could not query memory balloon allocation. This error is therefore expected, not really an error and can also be ignored.
  11. shell> virsh : enter Virsh and confirm that the win2008r2 VM exists and then leave Virsh.
  12. shell> virt-viewer win2008r2 : connect to the win2008r2 console
  13. Windows installer was restarted and is now completing and will reboot the VM.
  14. Since the windows OS is now installed, the boot process will not close virt-viewer and windows server 2008r2 will now load. You need to specify an Administrator password.
  15. After you specified the Administrator password, windows desktop will load for the first time.
  16. We now need to confirm that network is working and also we want to enable Remote Desktop
    1. Set a static IP address
      1. Click on "Configure Networking" in the image above and in Network Connections right click on "Local Area Connection. Then in "Local Area Connection Properties double click on "Internet Protocol Version 4 (TCP/IPv4)".
      2. Select "Use the following IP address:" and then fill in suitable values for your network. Press Ok and Ok again and close down "Network Connections" windows.
      3. Open a windows cmd prompt and try to ping the new VM - there is no echo and that is because default Windows 2008r2 does not allow ping.
    2. Allow ping on the firewall
      1. Open Start > Administrative Tools > "Windows Firewall with Advanced Security".
      2. Click on "Inbound Rules" and scroll down to "File and Printer Sharing (Echo Request - ICMPv4-In)" and right click and then select "Enable" on the context menu. Close the "Windows Firewall with Advanced Security" window.
      3. Try to ping again from your windows desktop cmd prompt, this time you should get an echo from your VM.
    3. Enable Remote Desktop
      1. In "Initial Configuration Tasks" scroll down to "Enable Remote Desktop" and click on it.
      2. Click on radiobox number 2 (number 3 gives higher security but you need to have an updated RDP client). Remote Desktop will be added to your firewall. Click Ok and Ok.
      3. Notice that Remote Desktop have been enabled.
      4. On your dev box click on Start > All Programs > Accessories > "Remote Desktop Connection".
      5. Write in the IP address you specified for your virtual server above and click "Connect".
      6. Logon as Administrator. The Administrator password you specified before then you first logged on to the server.
      7. Confirm that you want to connect by pressing the Yes button.
      8. Congratulation - you are in. Also notice that in your virt-viewer window that you are now logged out because only 1 Administrator can be logged on at the same time.

Execute virt-install remote from an Ubuntu desktop

  1. Open an Ubuntu desktop and start a terminal (here I use Ubuntu 10.04.3 because version 11.04 & 11.10 have an error with virt-viewer over ssh)
  2. shell> ssh root@192.168.1.25 : connect to the Ubuntu host server (here on IP 192.168.1.25). You will be asked for the root password and if valid you will be logged on as root and get a prompt on the server.
  3. shell> cd /var/VMs : change directory to /var/VMs and check the content with ls -l.
  4. shell> nano vminstall.sh : open vminstall.sh in nano and uncomment the php5.2 line (be sure the win2008r2 line is commented). Save and exit (ctrl+x and then y)
  5. shell> ./vminstall.sh : execute vminstall.sh and follow the progress.
  6. After installing the VM, virt-install will boot the VM on the specified iso file. The iso file contains the ubuntu installer which is graphical and virt-install therefore loads virt-viewer to connect to the VMs console, but we are on the ubuntu host server and there is no graphics there, so we get the error Cannot open display. This error is expected.
  7. shell> virsh : start Virsh to confirm that the php5.2 VM is created.
  8. virsh> list --all : list all virtual machines. You should see that php5.2 exist and is powered on (running). virsh> quit to leave Virsh.
  9. shell> exit : leave the Ubuntu host server s1 and return to the local Ubuntu desktop ud2 prompt.
  10. shell> virt-viewer --connect qemu+ssh://root@192.168.1.25/system php5.2 : from the Ubuntu desktop connect virt-viewer to the php5.2 VM on the Ubuntu host server.
  11. virt-viewer is connected to the php5.2 VM console and as you can see, the Ubuntu installer program have started. Finish the installation off.
    • While installing, don't forget to select OpenSSH.
  12. After installing is finished, the VM will reboot which will make virt-viewer close. You are back on your local terminal prompt.
  13. The VM may also have turned off, so you need to be sure that your new VM is turned on :
    • shell> ssh root@192.168.1.25 : connect to the Ubuntu host server
    • shell> virsh : connect to virsh on the Ubuntu host server.
    • virsh> list --all : in my case, the new php5.2 VM was powered off.
    • virsh> start php5.2 : power on the php5.2 VM
    • virsh> list --all : ok, php5.2 is now powered on.
    • virsh> exit : exit Virsh and return to the Ubuntu host server prompt.
    • shell> exit : exit the Ubuntu host server prompt and return to the Ubuntu desktop prompt.
  14. shell> virt-viewer --connect qemu+ssh://root@192.168.1.25/system php5.2 : connect virt-viewer on the Ubuntu desktop to the console of php5.2 VM on the Ubuntu server.
  15. If your virt-viewer is unresponsive :
    • like this,
    • or like this,
    • then do this : ctrl+alt+F4.
  16. You should now have this.
  17. Login with the user you created then you installed the Ubuntu guest OS.
  18. shell> sudo passwd root : activate the root user by setting a password for root. You will be asked for your own password and then for the new password for the root user twice.
  19. Setting up network on the new Ubuntu guest OS :
    1. shell> nano /etc/network/interfaces : time to configure network on your Ubuntu guest OS.
    2. default network configuration
    3. the configuration we need
    4. shell> ifdown eth0 && ifup eth0 : restart the eth0 network (in Ubuntu version 11.10 you are not supposed to use /etc/init.d/networking restart, instead you are supposed to stop & start each network device individually.
  20. Close virt-viewer.
  21. shell> ssh root@192.168.1.56 : from your Ubuntu desktop terminal ssh into the php5.2 VM. Congratulation - you are in.
  22. ssh into the php5.2 VM using Putty on a Windows desktop
  23. Login as root and you will get a prompt on the virtual machine vs1. Congratulation - you are in.

Manage your virtual machines

The main tools for managing QEMU virtual machines are
  • virsh : Virsh command reference : a CLI tool for various operations, you cannot properly handle your VMs without virsh.
  • virt-viewer :
  • virt-clone :
  • virt-manager : a Virtual Machine Manager GUI, but sadly inferior to Hyper-V and VirtualBox GUI managers.
  • qemu-img : harddrive operations
  • a text-editor : for xml file inspection (qemu defines virtual machines in xml files and you want to look at them)

Virsh

Here are the most important Virsh commands, however you can also consult the full Virsh command reference.

  • shell> virsh : enter the virsh prompt.
  • virsh #> list --all : list all defined virtual machines (whether the vm is in running or shut off state).
  • virsh #> start VMTest : turns on the power of the virtual machine called VMTest.
  • virsh #> shutdown VMTest : sends the ACPI signal to the VMTest operating system - this will only turn off the VM if there is an OS installed (it seems somewhat buggy though).
  • virsh #> destroy VMTest : turns off the power to the virtual machine - this will turn the VM off whether or not an OS is installed.
  • virsh #> reboot VMTest : reboot the virtual machine.
  • virsh #> undefine VMTest : deletes the /etc/libvirt/qemu/VMTest.xml file, the virtual harddrive is not deleted, but can be deleted manually.
    (you need to shutdown or destroy the VM before you can undefine it)
  • virsh #> define /var/MyXmlDefinitions/VMText.xml : creates a domain as specified in the VMTest.xml file. I think a new xml file will be created in /etc/libvirt/qemu named after the domain within the VMText.xml file (I need to test to be sure).
  • virsh #> console VMTest : connect to the virtual machines console (since the console command will load virt-viewer, you need to run this from a remote ssh connection with graphics, eg from Putty/Xming or from an Ubuntu desktop terminal).
  • virsh #> dumpxml VMTest : outputs the /etc/libvirt/qemu/VMTest.xml file to screen - good to see all properties of the VM.
  • virsh #> dumpxml VMTest > /var/VMs/VMTest.xml : outputs the /etc/libvirt/qemu/VMTest.xml file to another file /var/VMs/VMTest.xml.
  • virsh #> edit VMTest : loads /etc/libvirt/qemu/VMTest.xml file in Vim - I use this only then I have copied the VM xml file, this typically means you have to edit the hardware address of the virtual network card as well as the source file of the virtual hard drive.
  • virsh #> dominfo VMTest : some info about the guest.
  • virsh #> vcpuinfo VMTest : info about the virtual CPU of the guest.
  • virsh #> nodeinfo : some info about the host.
  • virsh #> autostart VMTest : VMTest will now automatically turn on then the host server boots up (you can see all autostarts in /etc/libvirt/qemu/autostart).
  • virsh #> autostart --disable VMTest : VMTest will now NOT automatically turn on the host server boots up.

How to rename a virtual machine - some virsh commands in action

A virtual machine including it's name is defined in an xml file. We can define a brand new VM using just virsh define someVMDefinition.xml, so our procedure will be to edit the VM xml file and reload the virtual machine based on that edited xml file.

  1. shell> cd /var/VMs/VHDs : navigate to the folder containing the virtual harddrives (your folder path may be different).
  2. shell> dumpxml VMOldName > VMNewName.xml : dump the xml defintion file and call it VMNewName.xml (since we are going to edit the .xml file to specify the new name).
  3. shell> virsh destroy VMOldName
  4. shell> virsh undefine VMOldName : delete the VM (any virtual harddrive(s) are NOT deleted).
  5. shell> mv VMOldName VMNewName : change the name of your virtual harddrive file to reflect the new name of the virtual machine to which the harddrive belong.
  6. shell> nano VMNewName.xml : load the VM xml definition file in the nano editor and edit the following :
    • <domain type='kvm' id='someNumber'>
      • <name>VMNewName</name> : change the name.
      • <devices>
        • <disk type='file' device='disk'>
          • <source file='/var/VMs/VHDs/VMNewName'/> : change the virtual harddrive file name (if you changed it also).
  7. shell> virsh define VMNewName.xml : make a brand new VM based on the VM defintion file, VMNewName.xml, just edited.
  8. shell> virsh start VMNewName : start the new VM
  9. shell> virsh autostart VMNewName : if you want VMNewName to startup automatically then the host server starts.

Appendix : How to clone a virtual machine

While installing a new VM is very fast it is often even faster to clone a VM. Imagine you have a well configured Ubuntu on a VM with many specialized packages and you want to have a new one nearly identical - then it could take a long time to install and configure, but cloning would just take a moment.

Here I am cloning the u4 (Ubuntu-4) virtual machine calling the new cloned virtual machine for u5 :

  1. Start Xming.
  2. Make a remote Putty connection to the host server with X11 forwarding.
  3. Login as root.
  4. On the host OS use Virsh to power off the VM you want to clone - here u4.
  5. shell> virt-clone --connect=qemu:///system -o u4 -n u5 -f /var/VMs/VHDs/u5 : clone u4 and call the new VM for u5
    • --connect : specify the hypervisor to connect to - here qemu:///system.
    • -o : original VM - here u4.
    • -n : new VM - here u5.
    • -f : file to use for virtual hard drive (VHD) - here /var/VMs/VHDs/u5 (will get the same size as the original u4).
  6. Use Virsh to power on u4 & and the new u5.
  7. shell> virt-viewer u5 : use virt-viewer to connect to the u5 console.
  8. Note the u4 login - the guest OS is exactly like on the u4 machine.
  9. If the virt-viewer windows does not accept keyboard input :
    • right click on the Xming icon and deselect "Hide root window"
    1. shell> echo u5 > /etc/hostname : set the hostname to u5.
    2. shell> service hostname start : restart hostname.
  10. Right now u4 & u5 have the same IP addres. Change the IP address of u5 :
    1. shell> ifconfig -a : be sure that eth0 exists. If eth0 does not exist but eth1 exist instead, then virt-clone have given eth0 on the new machine the same hardware address as eth0 on the original machine - that happen sometimes!
    2. If you do not have eth0, you can choose either to configure eth1 or to change eth1 to eth0.
    3. Here is how to change eth1 to eth0 if necessary : (you are still connected to u5 console using virt-viewer)
      1. shell> nano /etc/udev/rules.d/70-persistent-net.rules : load the network rules in the nano editor
      2. If you compare u5 eth0 hardware address with u4 eth0 hardware address, they are identical. Also eth1 hardware address is identical to the u5 VM network card xml definition.
      3. Comment out the eth0 line and change eth1 to eth0.
      4. press ctrl+x and then y to exit and save.
      5. shell> reboot
      6. Then the OS on u5 is coming up note the prompt have the correct hostname u5. Login.
    4. shell> nano /etc/network/interfaces load the interfaces definition file in the nano editor.
    5. Same IP address as u4 (be sure you use eth0 or eth1 depending on what interface card exists)
    6. Change the IP address.
    7. press ctrl+x and then y to exit and save.
    8. shell> ifdown eth0 && ifup eth0 : restart eth0
  11. Close virt-viewer.
  12. Open Putty and connect
  13. Congratulation - you are in

Appendix : How to resize a virtual hard drive

Increasing the size of a virtual hard drive is a common need, especially it makes it possible to provision a VHD for the current need without guessing the future need.

Increasing the size of a virtual hard drive is a another task that QEMU does NOT make easy : in VirtualBox you can specify dynamic size which pretty much makes this task automatically (though I admit it probably does so with decreased performance of the hard drive). Well with QEMU you have to go through a long list of tasks :

Above I made the php5.2 virtual harddrive only 20G, however actually Favourite Design hosts a huge amount of old legacy PHP websites, therefore I need quite a lot larger harddrive for these oldies. Here I will add an extra 40G.

Since part of the operation will be in GUI mode, I need to execute from a terminal with graphics - here I use Putty/Xming on a Windows desktop :

  1. Download GParted live iso, here version 0.10.0-3, and copy it to /var/VMs/ISOs.
  2. Start Xming.
  3. Start Putty with X11 forwarding.
  4. Login as root.
  5. shell> ls -l /var/VMs/ISOs : confirm that you have the gparted live iso file.
  6. shell> virsh : enter the Virsh utility.
  7. virsh> list --all : check the power status of your VMs.
  8. virsh> destroy php5.2 : turn off the php5.2 machine.
  9. virsh> list --all : confirm that php5.2 is turned off.
  10. virsh> exit : exit Virsh and return to the system prompt.
  11. shell> cd /var/VMs/VHDs : change directory to /var/VMs/VHDs
  12. shell> ls -lh : list content of /var/VMs/VHDs
  13. shell> cp php5.2 php5.2-copy : create a copy of your php5.2 VHD (Virtual Hard Drive) to work with in case something goes wrong. This operation can take a long time.
  14. shell> mv php5.2 php5.2-original : change the name of php5.2 to php5.2-original and store it untouched until you have confirmed your new VHD works.
  15. shell> qemu-img create -f raw php5.2-extension 40G : create a new raw VHD file 40G big.
  16. shell> cat php5.2-copy php5.2-extension > php5.2 : concatenate the 2 files, php5.2-backup & php5.2-extension, and write the result as php5.2. This operation can take a long time. The new php5.2 will have 40 GB of unallocated space which we later use GParted to allocate (not belonging to any partition).
  17. shell> ls -lh : list directory content again to confirm that the php5.2 file is now 20+40G big.
  18. shell> qemu -hda php5.2 -cdrom /var/VMs/ISOs/gparted-live-0.10.0-3.iso -boot d : (from Ubuntu 12.04, qemu must be replaced with qemu-system-x86_64)
    • qemu : emulates a machine on the fly.
    • -hda : sets the first harddrive, here to php5.2.
    • -cdrom : points to what CD is in the cdrom drive, here the gparted live iso (note that the cdrom becomes d drive because only one hard drive is specified).
    • -boot : tells which drive to boot on, here d (the cdrom drive with the gparted live CD in).
  19. GParted splash screen. Press Enter or wait 30 seconds for auto boot.
  20. Press Enter to select default - "Don't touch keymap".
  21. Press Enter to select default - "33" (US language).
  22. Press Enter to select default - "0" (GUI).
  23. GParted shows your partitions.
  24. Right click on the /dev/sda2 row and select Resize/Move from the context menu.
  25. Drag the right handle as long as possible to the right.
  26. The sda2 partition is now at maximum size, 44031 bytes. Press the Resize/Move button.
  27. Right click on the /dev/sda5 row and select Resize/Move from the context menu.
  28. Drag the right handle as long as possible to the right.
  29. Then Drag the left handle to the right until the with of the sda5 partition is about 3000 bytes with. Press the Resize/Move button.
  30. Right click o the /dev/sda2 row and select Resize/Move from the context menu.
  31. Drag the left handle as long as possible to the right.
  32. Click the Resize/Move button.
  33. Right click on the /dev/sda1 row and select Resize/Move from the context menu.
  34. Drag the right handle as long as possible to the right.
  35. Click on the Resize/Move button.
  36. Click on the Apply button.
  37. After you confirm, GParted starts to work on partioning.
  38. Click on the Close button.
  39. The Exit buttons seems not to work, so I close the Xming window.
  40. Back at the Ubuntu host prompt, I turn on the php5.2 machine.
  41. Congratulation - your php5.2 machine is working now with a 60G hard drive.
  42. After you have confirmed that your new VHD is ok (eg. if you have websites hosted on it and the work), then delete the left over files :
    1. shell> cd /var/VMs/VHDs
    2. shell> ls -lh : confirm the existence of php5.2-original, php5.2-copy and php5.2-extension, which have no use any longer.
    3. shell> rm php5.2-original php5.2-copy php5.2-extension : delete these left over files
    4. shell> ls -lh : confirm the files are deleted.

If then logging on to the new resized machine, you get the following error : mountall plymouth command failed, it probably means your swap partition have been destroyed or you have created a new swap partition with a new UUID. To solve the problem, you need to recreate your swap and update /etc/fstab with the UUID for your new swap :

  1. shell> swapon -s : list all mounted swap files (if the list is empty you have no mounted swap files).
  2. shell> fdisk -l : list your partitions. Typically you will have a swap partition as sda5 or if the harddrive is virtual then vda5.
  3. shell> mkswap /dev/vda5 : make a swap file on your swap partition (here /dev/vda5). You should get a new UUID.
  4. shell> swapon -U UUID : enable the new swap file passing in the UUID you got above.
  5. shell> swapon -s : this time your new swap file should be listed.
  6. Make the swap file permanent :
    1. shell> nano /etc/fstab : open fstab in the nano editor.
    2. Add the following to the end of fstab :
      • UUID=7add7c63-6c62-4a0a-893c-147f3e40298f none swap sw 0 0 : change the UUID with your own UUID
        • (If you already have a swap line in your fstab, then owerwrite the existing UUID with your new UUID instead)
    3. Exist and save your fstab file.
  7. shell> reboot now : reboot your virtual machine to confirm your problem is solved.

Appendix : How to add a second virtual harddrive to an existing virtual machine

QEMU supports different image formats for virtual harddrives. The 2 most important are raw and qcow2, however here is the full list of QEMU disk formats :

  • raw : Raw disk image format (default). This format has the advantage of being simple and easily exportable to all other emulators. If your file system supports holes (for example in ext2 or ext3 on Linux or NTFS on Windows), then only the written sectors will reserve space.
  • qcow2 : QEMU image format, the most versatile format. Use it to have smaller images (useful if your file system does not supports holes, for example: on Windows), optional AES encryption, zlib based compression and support of multiple VM snapshots.
  • qcow : Old QEMU image format. Only included for compatibility with older versions.
  • cow : User Mode Linux Copy On Write image format. The cow format is included only for compatibility with previous versions. It does not work with Windows.
  • vmdk : VMware 3 and 4 compatible image format.
  • loop : Linux Compressed Loop image, useful only to reuse directly compressed CD-ROM images present for example in the Knoppix CD-ROMs.

Then attaching a harddrive to a machine (here a virtual harddrive to a virtual machine), we need to choose what HD controller to use. Typically we can choose between IDE, SCSI and VIRTIO. However, beware that IDE does not support hot plug, so it is not possible to attach an IDE virtual harddrive to a running virtual machine - in effect the virsh attach-disk command is useless for attaching IDE drives.

  • hda : specifies the first (a) drive (d) on the IDE (h) bus.
  • hdb : specifies the second (b) drive (d) on the IDE (h) bus.
  • sda : specifies the first (a) drive (d) on the SCSI (s) bus.
  • vda : specifies the first (a) drive (d) on the VIRTIO (v) bus.

The method below is supposed to work - but it doesn't :

  1. shell> qemu-img create -f raw win2008r2-d 20G : create a new virtual harddrive called win2008r2-d of format raw with initial size 0 bytes and able to grow to 20G.
  2. shell> qemu-img info win2008r2-d : display information about the just created virtual harddrive.
  3. shell> virsh attach-disk win2008r2 win2008r2-d hdb : attach the win2008r2-d disk as the second disk on the IDE bus (hdb) on the win2008r2 VM. attach-disk only works on a running VM.
  4. Currently /etc/libvirt/qemu/win2008r2.xml does not reflect the new harddrive, to make that happen do the following : (actually, I can probably just add the --persistent option to attach-disk to get the xml definition file updated as well, see here)
    1. shell> virsh dumpxml win2008r2 > /tmp/win2008r2.xml : dump the xml definition to file.
    2. shell> virsh destroy win2008r2 : power off to be able to undefine the virtual machine.
    3. shell> virsh undefine win2008r2 : undefine the virtual machine.
    4. shell> virsh define /tmp/win2008r2.xml : define a new virtual machine.

Currently my only working solution is to edit the xml definition file to use the new disk INSTEAD OF the cd-rom.

Some links with info about QEMU virtual disk images


Appendix : Change CD in the CD-ROM drive

  1. shell> virsh : enter the virsh shell.
  2. virsh> qemu-monitor-command win2008r2 "info block" : display address information for each attached storage.
  3. shell> qemu-monitor-command win2008r2 "eject drive-ide0-0-0" : eject cd-rom drive (here cd-rom drive is specified as a storage address).
  4. shell> qemu-monitor-command win2008r2 "change drive-ide0-0-0 /var/VMs/ISOs/ubuntu-11.10-server-amd64.iso" : insert the ubuntu 11.10 iso file (again cd-rom drive is specified as a storage address).

Appendix : How to move a virtual machine to another host machine

@ Favourite Design we had too many virtual machines on our dedicated VM host (called s1) so I decided to offload it by moving some virtual machines to a second VM host (as of current to our backup server called backup1). Here I show how I moved a virtual machine hosting our second nameserver - this virtual machine is called fhNs2 (Favourite Hosting Name Server 2) :

  1. Here is my existing content :
    • old host shell> virsh list --all : Existing VMs on s1 (old host server).
    • new host shell> virsh list --all : Existing VMs on backup1 (new host server).
  2. old host shell> cd /var/VMs/VHDs : navigate to the folder containing all the virtual harddrives.
  3. old host shell> virsh dumpxml fhNs2 > fhNs2.xml : write the fhNs2 VM xml definition file to fhNs2.xml.
  4. old host shell> virsh destroy fhNs2 : turn off the fhNs2 VM.
  5. old host shell> virsh undefine fhNs2 : delete the fhNs2 VM (this will NOT delete the virtual harddrive).
  6. old host shell> virsh list --all : check that fhNs2 does not exist anymore.
  7. old host shell> ls -l : check that the fhNs2 xml definition file and the fhNs2 virtual harddrive exists.
  8. new host shell> cd /media/disk2/VMs/VHDs : navigate to folder containing all the virtual harddrives.
  9. new host shell> scp root@OldHostIP:/var/VMs/VHDs/fhNs2 . : copy the fhNs2 virtual harddrive from the old host to the new host (don't forget the dot specifying target as current folder).
  10. new host shell> scp root@OldHostIP:/var/VMs/VHDs/fhNs2.xml . : copy the fhNs2.xml VM definition file from the old host to the new host.
  11. new host shell> ls -l : confirm that you have the virtual harddrive (fhNs2) and the VM definition file (fhNs2.xml).
  12. new host shell> nano fhNs2.xml : open fhNs2.xml in the nano editor and change the path to the virtual harddrive :
    • <devices>
      • <disk type='file' device='disk'>
        • <source file='/media/disk2/VMs/VHDs/fhNs2' /> : in my case the virtual harddrive (fhNs2) is located on a different file path on the new host, so that need to be changed in the xml definition file.
  13. new host shell> virsh define fhNs2.xml : create the virtual machine using the fhNs2.xml defintion file.
  14. new server shell> virsh list -all : confirm the virtual machine is created.
  15. new server shell> virsh start fhNs2 : start the virtual machine.
  16. new server shell> virsh autostart fhNs2 : I also want the virtual machine to automatically turn on in case the host server is restarted.

Appendix : Virtualization Concepts

  • Virtualization : In IT virtualization means to create a virtual version of something, like eg. a server machine, a network, a harddrive, etc. In server virtualization, the idea is to create multiple virtual server machines (the machines not the OS'es) hosted on a single physical server machine (thereby reducing cost to hardware, easing maintenance and allow for very fast provisioning - to install a new virtual server is extremely fast compared to install a new physical server).
  • Hypervisor : Software able or dedicated to host, create and maintain virtual machines, eg. VirtualBox (my favourite dev hypervisor), Windows Hyper-V, Linux QEMU (my favourite production hypervisor), Linux XEN and VMwares ESXi are well know hypervisors.
  • Host OS >< Guest OS : on a bare metal machine one OS is installed, that is called the host OS and can be eg. Windows, Windows Hyper-V, VMwares ESXi hypervisor or some Linux distro. The host OS can create multiple virtual machines and on each of these virtual machines another OS can be installed, these OS'es are called Guest OS'es. Eg. on Windows 7 we can use VirtualBox to create virtual machines and on one of these VM's we could install Solaris and on another we could install CentOS - Windows 7 would then be the host OS and Solaris and CentOS would be guest OS'es.
  • Type 1 >< Type 2 hypervisors : I am not sure if this distinction is not mostly hype, however we can maybe say that since Windows Hyper-V and ESXi are both OS'es and dedicated virtualization, they are of type 1 while VirtualBox not being an OS is of type 2. But what about Windows Server 2008 with Hyper-V role or Ubuntu with KVM/QEMU, they are definitely OS'es capable of virtualization, though you could say they are not dedicated virtualization OS'es and so they may be called type 2 hypervisors (some better people than me will call them type 1).
  • libvirt : homepage. Virtualization API.
  • QEMU : homepage. Machine emulator and virtualizer. Virtualization is supported using KVM module or Xen hypervisor.
  • KVM   : homepage. Kernel based Virtual Machine. Makes it possible for QEMU to execute guest OS'es directly on the hosts physical CPU.

Appendix : Common errors and solutions

  1. shell> virt-install ..params.. : results in "Connected to domain VMTest" with Escape character is ^]. After you press ctrl+], you get Domain installation still in progress. You can reconnect to the console to complete the installation process.
  2. virsh> console VMTest : results in "Connected to domain VMTest" with Escape character is ^]
  3. shell> virt-viewer -c qemu:///system VMTest : errors Cannot open display.

Reason : If you have one of the above errors, 1, 2 or 3, it is most likely because virt-viewer is tried loaded on a system without a windows manager.

Solution 1 : Execute virt-viewer remote from a system with a windows manager, eg. Ubuntu desktop or Windows desktop (see above how to do that).

Solution 2 : Install a windows manager on your system, eg. Ubuntu desktop (probably the least good solution if your system is a production server).

  1. shell> virt-viewer --connect qemu+ssh://user@IP/system VMName errors Bad port '0'.

Reason : This seems to be a known error in Ubuntu 11.04 & 11.10, reported here.

Solution : Use an earlier version of Ubuntu, eg. 10.04.3 (also the error may be solved in later versions)

  1. shell> virt-viewer VMTest : errors No bootable device.

Reason : If you have the above error 5, you have tried to use virt-viewer to connect to the console of a virtual machine without any OS installed.

Solution :

  1. Close the virt-viewer window.
    • If your OS to install is 32 bit use qemu :
      • shell> qemu -hda /var/VMs/VHDs/VMTest -cdrom /var/VMs/ISOs/ubuntu-11.10-server-amd64.iso -boot d : use qemu to create a virtual machine on-the-fly with the relevant hard drive and boot it on the installer iso.
    • If your OS to install is 64 bit use qemu-system-x68_64
      • shell> qemu-system-x86_64 -hda /var/VMs/VHDs/VMTest -cdrom /var/VMs/ISOs/ubuntu-11.10-server-amd64.iso -boot d : use qemu to create a virtual machine on-the-fly with the relevant hard drive and boot it on the installer iso.

qemu itself unfortunately emulates only an i686 CPU and so it cannot boot on an x86_64 Ubuntu kernel

Comments

You can comment without logging in
 
 B  U  I  S 
Words: Chars: Chars left: 
 Captcha 
 Nickname
Facebook
    
yugandhar.yetham@gmail.com
User type : Standard
Register : 2013-Mar-03
Topics : 1
Replies : 5
--------------
      report  reply  
Hi,

I am getting below error while connecting the virtual machine through my ubuntu desktop. Please let me know what i do now to get resolve this problem.

sudo virt-viewer --connect qemu+ssh://noc@192.168.1.1/system kvm-vm004

(virt-viewer:3755): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",

(virt-viewer:3755): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",

(virt-viewer:3755): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",

(virt-viewer:3755): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",
The authenticity of host '192.168.1.1 (192.168.1.1)' can't be established.
RSA key fingerprint is 16:32:a8:1e:c1:61:77:7f:ed:38:9d:3f:05:b2:8a:74.
Are you sure you want to continue connecting (yes/no)? yes

----
Thanks,
Yugandhar Yetham



Rasmus
User type : Admin
Register : 2012-Dec-21
Topics : 0
Replies : 108
--------------
      report  reply  

Hi yugandhar   (remember to login if you want to get an email then there is an answer to your post)

It seems that the error you get is a known bug in Ubuntu 11.10 (and possible other versions as well), see here : http://askubuntu.com/questions/66356/gdk-gtk-warnings-and-errors-from-the-command-line

The solution seems to be to install gtk2-engines-pixbuf :
shell> sudo apt-get install gtk2-engines-pixbuf

Be sure to read the "Execute virt-install remote from an Ubuntu desktop" section above if you have not already read it.

Also note that virt-viewer and ssh does not work well together in Ubuntu 11.04 & 11.10.

web fiddler by nature

Anonymous
--------------
      report  reply  
Hi Rasmus,

It works for me.

Virt-Viewer console giving me a blank screen at th first time  when trying to connect the VM whereas it is working if i give the password second time. But send Key Ctrl+Alt+F4 is not working here.

Anyway it is working for me. :)

Thanks alot.

Yugandhar Yetham


Rasmus
User type : Admin
Register : 2012-Dec-21
Topics : 0
Replies : 108
--------------
      report  reply  
Hi Yugandhar, glad to hear you made it work 

web fiddler by nature

yasser
--------------
      report  reply  
VERY GREAT AND USEFUL ARTICLE! IT'S EVEN BETTER THAN WHAT I SAW @ubuntu.com!
Rasmus
User type : Admin
Register : 2012-Dec-21
Topics : 0
Replies : 108
--------------
      report  reply  
Thanks Yasser - nice to hear, you just made my tuesday morning a great morning.

web fiddler by nature

Yasser
--------------
      report  reply  
and also I had my monday a great day because your post solved my problem ;)

Rasmus, I would like to use your 'screenshot button' in my blog which is based on wordpress. May I ask you how do you add this capability to your blog?

thanks in advance!
Rasmus
User type : Admin
Register : 2012-Dec-21
Topics : 0
Replies : 108
--------------
      report  reply  
Hi Yasser

I am of course flattered that you like my screenshot logic and I would love to help you. However, as the logic involves both C-Sharp, Javascript, Css, Html & images, it is far too involved for an off-topic post in a comment track about Ubuntu virtualization. 

Instead if you are still interested, I will email you the screenshot raw code "as is" - I have no knowledge about Wordpress and you will need to accommodate the raw code to Wordpress yourself (you need to have programming experience). Email me rasmus@webmodelling.com and I will reply you the code.

web fiddler by nature

yugandhar.yetham@gmail.com
User type : Standard
Register : 2013-Mar-03
Topics : 1
Replies : 5
--------------
      report  reply  
Hi Rasmus,

I would like to create virtual machines using by ubuntu-vm-builder, but here the problem is that i am not familiar with how  i create templates. i would be very happy if you kindly let me know.


Thanks,
Yugandhar Yetham
I

Rasmus
User type : Admin
Register : 2012-Dec-21
Topics : 0
Replies : 108
--------------
      report  reply  

Hi yugandhar

I don't have experience with ubuntu-vm-builder, so I cannot help you with examples. However, I understand that ubuntu-vm-builder is intended for JeOS versions mainly for virtual appliances and it is difficult for me to see what ubuntu-vm-builder otherwise offers that cannot be done just as fast with the more flexible virt-install.

If you are still interested in ubuntu-vm-builder, I guess a good place to start is https://help.ubuntu.com/12.04/serverguide/jeos-and-vmbuilder.html

web fiddler by nature

yugandhar.yetham@gmail.com
User type : Standard
Register : 2013-Mar-03
Topics : 1
Replies : 5
--------------
      report  reply  
Hi Rasmus,

Is there any non-interactive vm installation. Please let me know. It is not always possible to connect the hypervisor through virtual machine manager after running the virt-install command. 
This command is asking for interactive method. 

Thanks in Advance.

----
Regards,
Yugandhar Yetham


Rasmus
User type : Admin
Register : 2012-Dec-21
Topics : 0
Replies : 108
--------------
      report  reply  

Hi yugandhar

You are right that virt-install is an interactive installation in the sense that after you have created the virtual machine, you need to interact with the virtual machine to install an operating system. I have not really been realizing that before, but that may be a point to add to the advantages of ubuntu-vm-builder over virt-install, that you just run your script and a virtual machine preinstalled with Ubuntu is created (I don't know how far this can be taken, eg. if networks can be configured directly in the script).

If you have problems connecting to the virtual machine after it have been created, it may be because you run virt-installer without forwarding x-windows to an x-windows server. Then virt-viewer is finished creating the virtual machine, it will actually boot on your iso file if specified using the --cdrom parameter. However, the iso installer is graphical and therefore if you execute virt-installer from a local console on your host server and your host server does not have x-windows installed, then you cannot see what the iso file is booting up and therefore you cannot interact with it. If this is the case, then go through the "Execute virt-install remote from a Windows desktop" section in the above tutorial (don't forget to forward X11 in putty).

Lastly, if you need to speed up your creation of virtual machines and operating system installation, you can use cloning, see the Clone a virtual machine section in the above tutorial. Cloning also needs some further interaction as networking needs to be redone in the clone.

 

web fiddler by nature

purs
User type : Standard
Register : 2013-Jul-03
Topics : 0
Replies : 3
--------------
      report  reply  
Hi,

Can you please guide me on how to setup VPS ( either  Xen or Vitrual Box) on  one dedicated server for Linux as well as Windows, 
Further I have set up ispconfig with OpenVz but all my servers are linux, Since I have an extra Ip and server resources so plan to install windows servers on the same Dedicated server
Thanks
Purs
Rasmus
User type : Admin
Register : 2012-Dec-21
Topics : 0
Replies : 108
--------------
      report  reply  

Hi purs

Unfortunately I have never had the opportunity to check out how ISPConfig handles vps (I am quite interested in it though), however I guess the following is true :

A good place to start with OpenVZ managed through ISPConfig may be here : http://www.howtoforge.com/installing-openvz-plus-management-of-vms-through-ispconfig-3-debian-6.0

As for Xen and VirtualBox : I have never used Xen and VirtualBox I only use for test environments on my windows dev box, so I would not know how to help you with that.

web fiddler by nature

yugandhar.yetham@gmail.com
User type : Standard
Register : 2013-Mar-03
Topics : 1
Replies : 5
--------------
      report  reply  
Hi Rasmus,

Can we use these KVM boxes for cloud coumputing instead of using citrix Xen Servers?

----
Thanks,
Yugandhar Yetham



Rasmus
User type : Admin
Register : 2012-Dec-21
Topics : 0
Replies : 108
--------------
      report  reply  
Hi yugandhar

I have no experience with cloud computing, however based on the following 2 links, I would guess the answer is yes :

web fiddler by nature

yugandhar.yetham@gmail.com
User type : Standard
Register : 2013-Mar-03
Topics : 1
Replies : 5
--------------
      report  reply  
Hi Rasmus,

Now  I am working on How to resize virtual Hard drive:

=> I downloaded the gparted live iso image file.

You have given the command only for "hda" drive and cdrom if we use. But i have a different one. Please check the below command which i am using and correct it asap as i am struck in the middle.

$ qemu -sda ubuntuvm001 -cdrom /home/noc/gparted-live-0.14.0-1.iso -boot d:
qemu: invalid option -- '-sda'

in the above command are all the options correct?

Kindly let me know that how to do it?

Thanks in Advance.

Rasmus
User type : Admin
Register : 2012-Dec-21
Topics : 0
Replies : 108
--------------
      report  reply  
Hi yugandhar

I think you may have misunderstood the -hda option.
  • -hda means that the next option (eg. ubuntuvm001) is the path to the file that should be loaded as virtual harddrive with index 0
  • -hdb means that the next option (eg. ubuntuvm001) is the path to the file that should be loaded as virtual harddrive with index 1
Indeed from the qemu man page, you can see that :
  • shell> qemu -hda ubuntuvm001 is equivalent to 
  • shell> qemu -drive file=ubuntuvm001,index=0,media=disk

Also -sda does not really give any meaning. If ubuntuvm001 is the path to your virtual harddrive (on which you need to allocate free space using gparted), then I think your command should be correct if you switch out -sda with -hda.

web fiddler by nature

Anonymous
--------------
      report  reply  
Rasmus,

Thanks for your reply,

I have the below things, please let me how to execute this using below things,

1) I have gparted live iso file in my home directory

noc@ubuntukvm001:~$ pwd
/home/noc
noc@ubuntukvm001:~$ ls -l
total 817872
-rw-r--r-- 1 noc noc      6413 2013-08-03 08:45 cmdlist.kvm
-rw-r--r-- 1 noc noc 132648960 2013-08-05 07:18 gparted-live-0.14.0-1.iso
-rw-r--r-- 1 noc noc 704833536 2013-07-16 23:47 ubuntu-10.04.4-server-i386.iso
drwxr-xr-x 3 noc noc      4096 2013-08-04 12:06 VMs

2) I have the concatenate img ubuntuvm001.img file is below

~$ cd VMs/VHDs/
noc@ubuntukvm001:~/VMs/VHDs$ ls -l
total 2966520
-rw-r--r-- 1 noc  noc  10737418240 2013-08-05 08:26 ubuntuvm001-2d
-rwxr-xr-x 1 root root 21474836480 2013-08-05 10:17 ubuntuvm001.img
-rwxr-xr-x 1 noc  noc  21474836480 2013-08-05 07:20 ubuntuvm001.img-copy
-rw-r--r-- 1 noc  noc  42949672960 2013-08-05 07:27 ubuntuvm001.img-extension
-rwxr-xr-x 1 root root 21474836480 2013-08-05 10:17 ubuntuvm002.img

by using above thing, please let me know the command to execute it.

Thanks in Advance,
Yugandhar Yetham

Rasmus
User type : Admin
Register : 2012-Dec-21
Topics : 0
Replies : 108
--------------
      report  reply  
Try this :
shell> qemu -hda /home/noc/VMs/VHDs/ubuntuvm001.img-extension -cdrom /home/noc/gparted-live-0.14.0-1.iso -boot d

From your filesystem list, it seems that the concatenated file is not ubuntuvm001.img but instead ubuntuvm001.img-extension. Be sure that you have backup of everything important before you proceed.

web fiddler by nature

Anonymous
--------------
      report  reply  
Hi Rasmus,

Isn't working with sd hard disk?

Please check the below and advise me.

noc@ubuntukvm001:~/VMs/VHDs$ qemu-img info ubuntuvm001
ubuntuvm001-2d             ubuntuvm001.img-copy
ubuntuvm001.img            ubuntuvm001.img-extension
noc@ubuntukvm001:~/VMs/VHDs$ qemu-img info ubuntuvm001-2d 
image: ubuntuvm001-2d
file format: raw
virtual size: 10G (10737418240 bytes)
disk size: 0
noc@ubuntukvm001:~/VMs/VHDs$ virsh attach-disk ubuntuvm001 ubuntuvm001-2d sdb
error: operation failed: adding scsi disk failed ubuntuvm001-2d: failed to add file=ubuntuvm001-2d,if=scsi


here i couldn't able to attach the new disk to the vm.  Please check it.

----
Thanks,
Yugandhar Yetham

yugandhar.yetham@gmail.com
User type : Standard
Register : 2013-Mar-03
Topics : 1
Replies : 5
--------------
      report  reply  
Hi Rasmus,

Can we do kvm on CentOS? Please let me know the link.

-----
Thanks,
Yugandhar Yetham

Rasmus
User type : Admin
Register : 2012-Dec-21
Topics : 0
Replies : 108
--------------
      report  reply  
Hi yugandhar

I have no experience with CentOS, however according to this link : http://wiki.centos.org/HowTos/KVM, KVM should be natively supported by CentOS.

web fiddler by nature

blades
--------------
      report  reply  
This guide made it all clear, installed everything as described and VM runs good. Thank you for your time webmodelling.com


click to top