Managing VM with QEMU-KVM

Lets discuss some Redhat  Type HyperVisor :

Here we are specially using  Virt-install command to  install / liveboot the VM's inside QemU-KVM  :



Case 1:  To create a fully-allocated (non-sparse) raw file:


root@Xpert:~# dd if=/dev/zero  of=/var/lib/libvirt/images/rhel6.qcow2 bs=1M count=6000

case  2:  new version of linux use fast method  

root@Xpert:~#   fallocate  -l  8G  /var/lib/libvirt/images/kali.qcow2


Case 3:   Create file by using  truncate

root@Xpert:~# truncate  --size=6G  /var/lib/libvirt/images/rhel6.qcow2

case 4:   create   qcow2  file

root@Xpert:~#  qemu-img create -f qcow2  /var/lib/libvirt/images/rhel6.qcow2  8192

Method  from Installing  qcow2 file
---------------------------------------------

root@Xpert:~# virt-install  --name rh --ram 2048 --vcpu 1 --file /var/lib/libvirt/images/rhel6.qcow2 --file-size=8  --location  http://192.168.122.1/rhel6

Starting install...
Retrieving file vmlinuz...                                                                                              | 3.9 MB  00:00:00    
Retrieving file initrd.img...                                                                                           |  30 MB  00:00:00    
Creating domain...     



=========

Method for  Live Boot :-

root@Xpert:~# virt-install  --name cirros --ram 512 --vcpu 1  --cdrom /home/xpert/cirros-0.3.2-x86_64-disk.img  --nodisk

Starting install...
Creating domain...                                          |    0 B  00:01    
Domain installation still in progress. You can reconnect to
the console to complete the installation process.


==========

Method For Installing  with  fallocate and normal .img file option

root@Xpert:~# virt-install  --name cirros --ram 512 --vcpu 1  --cdrom /home/xpert/cirros-0.3.2-x86_64-disk.img  --disk path=/var/lib/libvirt/images/c.img,size=8

Starting install...
Creating domain...                                          |    0 B  00:01    
Domain installation still in progress. You can reconnect to
the console to complete the installation process.




==========   taking  snapshot  of  a  img file in QEMU-KVM ===



Step 1:  taking  snapshot


root@Xpert:~#  qemu-img   create -f qcow2 -b  vm.img    snap.img


Step  2:  booting   from snapshot



root@Xpert:~#  virt-install  --name  redsnap  --ram  2048  --vcpu 2  --disk path=/var/lib/libvirt/images/snap.img --import






Comments

Post a Comment