KVM: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
(Der Seiteninhalt wurde durch einen anderen Text ersetzt: „=Installation= *KVM Installation = Links = * http://blog.loftninjas.org/2008/10/27/mounting-kvm-qcow2-qemu-disk-images/ * http:/…“)
Zeile 1: Zeile 1:
 
=Installation=
 
=Installation=
 
*[[KVM Installation]]
 
*[[KVM Installation]]
−
 
+
= Links =
−
=[http://docs.fedoraproject.org/de-DE/Fedora/12/html/Virtualization_Guide/sect-Virtualization_Guide-Installing_the_virtualization_packages-Installing_KVM_packages_on_an_existing_Fedora_system.html Fedora KVM]=
 
−
=[[Spice]]=
 
−
=Handling=
 
−
This command outputs the guest's XML configuration file to standard out (stdout).
 
−
You can save the data by piping the output to a file. An example of piping the output to a file called guest.xml:
 
−
 
 
−
virsh dumpxml GuestID > guest.xml
 
−
 
 
−
 
 
−
 
 
−
* [[Domain-Administration]]
 
−
 
 
−
= Migration zu neuem Host =
 
−
virsh migrate --live <GuestName> <DestinationURL>
 
−
 
 
−
Beispiel:
 
−
# virsh migrate --live galactica qemu+ssh://test2.example.com/system
 
−
 
 
−
=Autostart =
 
−
virsh autostart <domain>
 
−
virsh autostart <domain> --disable
 
−
 
 
−
=An/Aus=
 
−
Connecten auf Hypervisor
 
−
virsh -c qemu+ssh://''SERVER''/system
 
−
In Konsole eingeben
 
−
 
 
−
Zum starten:
 
−
start ''VM''
 
−
Zum virtuellen Stecker rausziehn:
 
−
destroy ''VM''
 
−
Nach Installation von '''acpid''' auf ''VM''
 
−
 
 
−
Normales herunterfahren:
 
−
shutdown ''VM''
 
−
 
 
−
=Configure a Serial Console in the Guest=
 
−
==Enable on the VM==
 
−
 
 
−
cat /etc/init/ttyS0.conf
 
−
 
 
−
# ttyS0 - getty
 
−
#
 
−
# This service maintains a getty on ttyS0 from the point the system is
 
−
# started until it is shut down again.
 
−
 
−
start on stopped rc RUNLEVEL=[2345]
 
−
stop on runlevel [!2345]
 
−
 
−
respawn
 
−
exec /sbin/getty -L 115200 ttyS0 xterm
 
−
 
 
−
Run the following command to initiate the Serial Console (or restart the VM):
 
−
 
 
−
sudo start ttyS0
 
−
 
 
−
==Connect on Host to VM==
 
−
 
 
−
console VM
 
−
00:50:56:00:31:f9
 
−
 
 
−
=Virtuelle MACAdresse vergeben=
 
−
 
 
−
gaius=KVM server
 
−
 
 
−
virsh console XXXXXXX
 
−
VM:    cp /etc/udev/rules./70-persistent.net(cd).rules 70-persistent.net(cd).rules.orig
 
−
VM:    herunterfahren...
 
−
gaius:  vi /etc/libvirt/qemu/XXXXXX.xml
 
−
 
 
−
-> MAC eintragen
 
−
 
 
−
gaius:    virsh define XXXXXXXX
 
−
gaius:    virsh start XXXXXXXX
 
−
 
 
−
-> TESTEN
 
−
 
 
−
=Images umwandeln=
 
−
*http://qemu-buch.de/de/index.php/QEMU-KVM-Buch/_Speichermedien/_Konvertieren_von_Image-Dateien
 
−
 
 
−
 
 
−
===img zu qcow2===
 
−
qemu-img convert -f raw -O qcow2 input.img output.qcow2
 
−
 
 
−
===qcow2 zu raw===
 
−
qemu-img convert -f qcow2 -O raw input.img output.raw
 
−
===raw zu vmdk===
 
−
qemu-img convert -f raw -O vmdk input.img output.raw
 
−
 
 
−
===qcow2 zu vmdk===
 
−
qemu-img convert -f qcow2 -O vmdk input.img output.raw
 
−
 
 
−
===4 unterstützten VirtBox-Typen:===
 
−
 
 
−
- .vdi      [ VirtualBox Disk Image ]
 
−
 
 
−
- .vmdk    [ Virtual Machine Disk ]
 
−
 
 
−
- .vhd      [ Virtual Hard Disk ]
 
−
 
 
−
- .hhd      [ Parallels Hard Disk ]
 
−
 
 
−
 
 
−
das ist falsch .... wer hat es geschrieben?
 
−
 
 
−
'''umwandeln VirtB. zu KVM'''
 
−
 
 
−
qemu-img convert "source".vmdk -O qcow2 "target".qemu
 
−
qemu-img convert "source".hhd -O qcow2 "target".qemu
 
−
qemu-img convert "source".vhd -O qcow2 "target".qemu
 
−
qemu-img convert "source".vdi -O qcow2 "target".qemu
 
−
 
 
−
'''RAW (for VirtualBox)'''
 
−
 
 
−
qemu-img convert "source".vmdk -O raw "target".img
 
−
 
 
−
'''umwandeln VirtB. zu VirtB. (vdi-vmdk)'''
 
−
 
−
VBoxManage clonehd "source".vdi "target".vmdk --format VMDK
 
−
 
 
−
==LVM in VMDK umwandeln==
 
−
lvcreate -L592M -s -n myvolume /dev/myvg/myvolume_snapshot
 
−
qemu-img convert /dev/myvg/myvolume_snapshot -O vmdk myvolume.vmdk
 
−
 
 
−
 
 
−
= RAW Image mounten =
 
−
 
 
−
Ein Raw Image ist ein einfaches Abbild einer Festplatte. Daher lässt es sich auch relativ leicht und ohne größere Umwege einhängen.
 
−
 
 
−
<pre>
 
−
losetup /dev/loop0 foo.img
 
−
kpartx -av /dev/loop0
 
−
mount /dev/mapper/loop0p1 /mnt
 
−
[arbeiten durchführen...]
 
−
unmount /mnt
 
−
kpartx -dv /dev/loop0
 
−
losetup -d /dev/loop0
 
−
</pre>
 
−
 
 
−
== QCOW2 Image mounten ==
 
−
 
 
−
Ein dynamisches QCOW2 Image kann im System nicht mehr einfach so gemounted werden. Dafür kann man einen Umweg über NBD (Network Block Device) nehmen. Damit wird das gewünschte Image als Network Block Device gestartet und eingehängt.
 
−
 
 
−
<pre>
 
−
modprobe nbd max_part=8
 
−
qemu-nbd --connect=/dev/nbd0 disk.img
 
−
mount /dev/nbd0p1 /mnt
 
−
</pre>
 
−
 
 
−
disconnecten
 
−
qemu-nbd --d /dev/nbd0
 
−
== Snapshot==
 
−
*http://kashyapc.wordpress.com/2013/01/22/live-backup-with-external-disk-snapshots-and-libvirts-blockpull/
 
−
 
 
−
== Weitere Infos ==
 
−
 
 
 
* http://blog.loftninjas.org/2008/10/27/mounting-kvm-qcow2-qemu-disk-images/
 
* http://blog.loftninjas.org/2008/10/27/mounting-kvm-qcow2-qemu-disk-images/
 
* http://doku.corvent.ch/doku.php/linux/kvm
 
* http://doku.corvent.ch/doku.php/linux/kvm
−
 
−
= Links =
 
−
 
 
* http://qemu-buch.de/d/Speichermedien/_Konvertieren_von_Image-Dateien
 
* http://qemu-buch.de/d/Speichermedien/_Konvertieren_von_Image-Dateien
 
* http://equivocation.org/node/107
 
* http://equivocation.org/node/107
 
* http://blog.dustinkirkland.com/2008/10/mounting-kvm-disk-image.html
 
* http://blog.dustinkirkland.com/2008/10/mounting-kvm-disk-image.html
−
 
−
 
−
==snapshot==
 
−
http://kashyapc.wordpress.com/2013/01/22/live-backup-with-external-disk-snapshots-and-libvirts-blockpull/
 
−
Huang Wenlong 2011-09-26 03:14:09 EDT
 
−
 
−
Verify it with libvirt-0.9.4-13.el6.x86_64
 
−
 
−
 
−
1. define a persistent domain named "snap"with qcow2 disks
 
−
2. create a snapshot for domain snap
 
−
# virsh snapshot-create snap
 
−
3.
 
−
virsh # snapshot-list snap
 
−
Name                Creation Time            State
 
−
------------------------------------------------------------
 
−
1317020538          2011-09-26 15:02:18 +0800 shutoff
 
−
 
−
4.virsh # undefine snap
 
−
error: Failed to undefine domain snap
 
−
error: Requested operation is not valid: cannot delete inactive domain with 1 snapshots
 
−
 
−
5. virsh undefine --snapshots-metadata snap
 
−
Domain snap has been undefined
 
−
 
−
4. check snapshot metadata (no metadata)
 
−
# ls /var/lib/libvirt/qemu/snapshot/snap
 
−
5. define a new domain with the same name, but different UUID
 
−
6. check snapshot for domain test:
 
−
# virsh snapshot-list snap
 
−
Name                Creation Time            State
 
−
---------------------------------------------------------
 
−
 
−
https://bugzilla.redhat.com/show_bug.cgi?id=735457
 
−
 
−
=Links=
 
−
==qemu-monitor==
 
−
http://blog.vmsplice.net/2011/03/how-to-access-qemu-monitor-through.html
 
−
 
−
= Links =
 
 
* http://wiki.centos.org/HowTos/KVM
 
* http://wiki.centos.org/HowTos/KVM
 
* https://help.ubuntu.com/community/KVM/Access
 
* https://help.ubuntu.com/community/KVM/Access

Version vom 5. Oktober 2017, 08:59 Uhr