Difference between revisions of "Kvm"

From Bashlinux
Jump to: navigation, search
(KVM)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
== How to determine if the host can run virtualization on hardware ==
+
=== How to determine if the host can run virtualization on hardware ===
 
* If the CPU supports hardware virtualization then ensure it is enabled on BIOS
 
* If the CPU supports hardware virtualization then ensure it is enabled on BIOS
 
<pre><nowiki>
 
 
# egrep -c '(vmx|svm)' /proc/cpuinfo
 
# egrep -c '(vmx|svm)' /proc/cpuinfo
</nowiki></pre>
 
   
 
=== How to quick launch an instance ===
 
== How to quick launch an instance ==
 
 
Create and empty disk of 1Gb and launch a VM as:
 
Create and empty disk of 1Gb and launch a VM as:
 
<pre><nowiki>
 
 
# dd if=/dev/zero of=disk.img bs=1M count=1024
 
# dd if=/dev/zero of=disk.img bs=1M count=1024
 
# qemu-kvm -boot d -hda disk.img -cdrom /dev/cdrom
 
# qemu-kvm -boot d -hda disk.img -cdrom /dev/cdrom
 
: On Ubuntu use <code>kvm</code> instead <code>qemu-kvm</code> command
</nowiki></pre>
 
 
On Ubuntu use `kvm` instead `qemu-kvm` command
 
   
 
Where
 
Where
* `-boot` [order=drives][,once=drives][,menu=on|off]
+
* <code>-boot</code> [order=drives][,once=drives][,menu=on|off]
 
'drives': floppy (a), hard disk (c), CD-ROM (d), network (n)
 
'drives': floppy (a), hard disk (c), CD-ROM (d), network (n)
* `-hda/-hdb` file use 'file' as IDE hard disk 0/1 image
+
* <code>-hda/-hdb</code> file use 'file' as IDE hard disk 0/1 image
* `-cdrom` file use 'file' as IDE cdrom image (cdrom is ide1 master)
+
* <code>-cdrom</code> file use 'file' as IDE cdrom image (cdrom is ide1 master)

Revision as of 02:08, 6 June 2015

How to determine if the host can run virtualization on hardware

  • If the CPU supports hardware virtualization then ensure it is enabled on BIOS
# egrep -c '(vmx|svm)' /proc/cpuinfo

How to quick launch an instance

Create and empty disk of 1Gb and launch a VM as:

# dd if=/dev/zero of=disk.img bs=1M count=1024
# qemu-kvm -boot d -hda disk.img -cdrom /dev/cdrom
On Ubuntu use kvm instead qemu-kvm command

Where

  • -boot [order=drives][,once=drives][,menu=on|off]
  'drives': floppy (a), hard disk (c), CD-ROM (d), network (n)
  • -hda/-hdb file use 'file' as IDE hard disk 0/1 image
  • -cdrom file use 'file' as IDE cdrom image (cdrom is ide1 master)