KVM Command Line¶
"virsh" shell for KVM.
List All Domain on KVM¶
Define or use .xml¶
Start KVM¶
Edit Guest .xml¶
List VNC Information¶
Test your bootable USB on kvm¶
In order to test your USB using KVM use following command.
In my case device was "/dev/sdb".Converting Existing Image¶
Converting VMWARE image for KVM¶
use following command.
Converting .ova to KVM image¶
what is ova - Open Virtualization Format
Download - Open Virtualization Format Tool
Install it, which give you command "ovftool".
converting .ova is just easy
some times ovftool failing
If Above does not work just do
tar -xvf Amazon-EC2-VM-Import-Connector.ova
Now follow Converting VMWARE image for KVM
Create New KVM Guest using existing Image¶
virt-install --name=own_cloud --arch=x86_64 \
--vcpus=1 --ram=512 --os-type=linux --os-variant=sles11 \
--hvm --connect=qemu:///system --network bridge:br0 \
--import --disk path=/home/vmware/ownCloud_in_a_box-1.0.4/ownCloud.qcow \
--accelerate --vnc --noautoconsole --keymap=us
Backup¶
Creating snapshot of Machine¶
NOTE :
- This will turn off your Guest.
- it will create snapshot in current working directory.
- Use virsh pwd to check your current working directory.
Quick Command Ref.¶
help Prints basic help information.
list Lists all guests.
dumpxml Outputs the XML configuration file for the guest.
create Creates a guest from an XML configuration file and starts the new guest.
start Starts an inactive guest.
destroy Forces a guest to stop.
define Outputs an XML configuration file for a guest.
domid Displays the guest's ID.
domuuid Displays the guest's UUID.
dominfo Displays guest information.
domname Displays the guest's name.
domstate Displays the state of a guest.
quit Quits the interactive terminal.
reboot Reboots a guest.
restore Restores a previously saved guest stored in a file.
resume Resumes a paused guest.
save Save the present state of a guest to a file.
shutdown Gracefully shuts down a guest.
suspend Pauses a guest.
undefine Deletes all files associated with a guest.
migrate Migrates a guest to another host.
setmem Sets the allocated memory for a guest.
setmaxmem Sets maximum memory limit for the hypervisor.
setvcpus Changes number of virtual CPUs assigned to a guest.
vcpuinfo Displays virtual CPU information about a guest.
vcpupin Controls the virtual CPU affinity of a guest.
domblkstat Displays block device statistics for a running guest.
domifstat Displays network interface statistics for a running guest.
attach-device Attach a device to a guest, using a device definition in an XML file.
attach-disk Attaches a new disk device to a guest.
attach-interface Attaches a new network interface to a guest.
detach-device Detach a device from a guest, takes the same kind of XML descriptions as command attach-device.
detach-disk Detach a disk device from a guest.
detach-interface Detach a network interface from a guest.
FU Commands¶
Create Disk¶
create disk of size 10G
File: for dynamic allocation
preallowcation
How to allow network access to KVM Guest¶
Modify guest.xml file and listen variable.
File: vi /etc/libvirt/qemu/Archlinux.xml
Extract folder from KVM Guest Image¶
This appears to be the far easy solution than I thought.
Link to official Document
For RHEL you require the following packages installed. - libguestfs-tools - libguestfs-xfs # if guest filesystem is XFS.
Image File explorer¶
This is a simple way to extract or access files.
Scan and assign the dev node.
List all the block devices, including newly scanned.
Mounting the file system
Once unmounted remove the lo drive.