Categories

Showing posts with label KVM. Show all posts
Showing posts with label KVM. Show all posts

Thursday, 6 February 2014

How to make a KVM Virtual machine boot From CDROM

Hi,

If you have a running KVM VM and you need to boot this VM from a Bootable Linux iso image inorder to fix some issues on the KVM machine. Below are the steps to boot the KVM machine from CD ROM.

KVM machine is using the xml files for the configuration. We need to edit the configuration xml file inorder to make any changes in the VM.

1_First Shutdown the VM using the command.

virsh shutdown vmname

2)Open the configuration file of the VM using the command

virsh edit vmname

3)Search for the word cdrom and add the lines as below

<disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/opt/isos/CentOS-6.3-x86_64-bin-DVD1.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>


Here we specified the iso image as the source file parameter.




4)Now the cdrom has been added on the VM. But now we need to make the cdrom as the first boot device.

For that we need to change the boot order of vm. Below is the lines which specifies the boot loader for the KVM vm


<os>
    <type arch='x86_64' machine='rhel6.2.0'>hvm</type>

<boot dev='cdrom'/>
<boot dev='hd'/>
    <bootmenu enable='yes'/>
  </os>






In above I put the boot device as cdrom in the parameter <boot dev='cdrom'/> and put it above the hd.

Now reboot the machine and then the vm will boot from the Linux iso image we added.

Cheers
Syamkumar




Wednesday, 22 May 2013

How to rename a KVM virtual machine image

Hello,

 Below is the steps to rename a kvm virtual machine.

1)Shutdown the Virtual machine first

virsh shutdown test1

or

virsh destroy test1

2) I just want to rename the virtual machine to test2

first dump the xml file of the old virtual machine which needs to be renamed

virsh dumpxml test1 > test2.xml

Then it will dump the xml file of test1 to test2.xml

The xml files are in the location /etc/libvirt/qemu


3)Then edit the file test2.xml using vi command line

vi /etc/libvirt/qemu/test2.xml

find the below two lines in the file

<domain type='kvm'>
  <name>test1</name>

replace the test1 with test2(new name)

Then save it and exit

4)Then undefine the older virtual machine using the command

virsh undefine test1

5)Define the new one using the command

virsh define /etc/libvirt/qemu/test2.xml


New renamed vm will start now.

regards
Syamkumar.M

Friday, 12 April 2013

How to fix sendmail error on Ubuntu

Hello,

 If you ever face below error on running sendmail on the Ubuntu server. Then please do the following fix.

error
-------------------
/etc/mail/sendmail.cf: line 100: fileclass: cannot open '/etc/mail/local-host-names': Group writable directory
-----------------------

Make a copy of  /etc/mail/sendmail.cf on the server before we edit it.

Fix
------------------------

Replacing line Fw/etc/mail/ local-host-names with line Fw-o /etc/mail/local-host-names in sendmail.cf, and Ft/etc/mail/trusted-users with line Ft-o /etc/mail/trusted-users in submit.cf and sendmail.cf.

save the file after making the above changes and then restart it.
-----------------------

Reference-
http://forums.fedoraforum.org/archive/index.php/t-199647.html



Regards
Syamkumar.M

 

Ad