command_line
This is an old revision of the document!
Table of Contents
KVM Command Line
“virsh” shell for KVM.
List All Domain on KVM
virsh list --all
Define or use .xml
virsh define <xyz.xml>
Start KVM
virsh start <xyz>
Edit Guest .xml
virsh edit xyz
List VNC Information
virsh vncdisplay xyz
Converting Existing Image
Converting VMWARE image for KVM
use following command.
qemu-img convert own_Cloud.vmdk -O qcow2 ownCloud.qcow
Converting .ova to KVM image
what is ova - Open Virtualization Format
Download - Open Virtualization Format Tool
Install it, which give you command “ovftool”.
ovftool -tt=vmx Amazon-EC2-VM-Import-Connector.ova amazon_kvm
converting .ova is just easy
some times ovftool failing
<span style="color:red;font-size:150%;">If Above does not work just do</span>
<p><span style="color:red;font-size:150%;"> tar -xvf Amazon-EC2-VM-Import-Connector.ova </span></p>
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.
virsh save <Domain Name> <fileName>
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
qemu-img create -f qcow2 vdisk.img 10G
command_line.1339755372.txt.gz · Last modified: 2020/08/10 02:28 (external edit)