Posts

Showing posts with the label KVM

How to resize VM disk size

This note provides steps to resize the KVM based VM images. In this situation, VM disk is raw format and filesystem is ext4. Expand disk size In order to expand disk size, VM must be shutdown Increase raw disk size qemu-img resize vm-1.img +10G Resize partition virt-rescue -a vm-1.img At rescue environment ><rescue> fdisk /dev/sdx Use normal fdisk command to delete partition and re-create the partition with bigger size. For this case, I would like to expand /dev/sda3 to have additional 10G ><rescue> fdisk /dev/sda d (select 3 to delete parition sda3) n (create new partition) select as primary select default start and end w (save the changes and exit from fdisk menu) ><rescue> e2fsck -f /dev/sda3 ><rescue> resize2fs /dev/sda3 ><rescue> sync ><rescue> exit I selected default start and end of disk because I want to use the rest of disk spac...

How to setup Kimchi(Wok) for management of KVM host

This note provides steps how to install kimchi(wok) for management of KVM virtualization Install Centos7 with Minimal installation Update system to up to date yum update -y Install KVM yum -y install qemu-kvm libvirt virt-install bridge-utils bind-utils virt-manager wget net-tools virt-viewer genisoimage epel-release Make sure KVM start upon reboot systemctl start libvirtd systemctl enable libvirtd Download Kimchi project installers wget https://github.com/kimchi-project/kimchi/releases/download/2.5.0/kimchi-2.5.0-0.el7.centos.noarch.rpm wget https://github.com/kimchi-project/kimchi/releases/download/2.5.0/wok-2.5.0-0.el7.centos.noarch.rpm wget http://kimchi-project.github.io/gingerbase/downloads/latest/ginger-base.el7.centos.noarch.rpm wget http://kimchi-project.github.io/ginger/downloads/latest/ginger.el7.centos.noarch.rpm Install RPMs yum localinstall * Start service systemctl enable wokd systemctl start wokd Allow firewall firewall-cmd --zone=public --pe...

How to setup KVM host and manage guest operation systems

This note provides steps how to install KVM and manage Guest OS with virsh. Install KVM yum -y install qemu-kvm libvirt virt-install bridge-utils bind-utils virt-manager wget net-tools virt-viewer genisoimage epel-release Install Guest OS from installer iso image virt-install --name VM-1 --ram 4096 --disk path=/testvm/VM-1.qcow2,size=40 --vcpus 2 --os-type linux --os-variant rhel6 --network bridge=br0 --graphics none --console pty,target_type=serial --cdrom /iso/CentOS-6.8-x86_64-bin-DVD1.iso --force Default directory for intalled VM /var/lib/libvirt/images/ Dump VM config into xml virsh dumpxml VM-1 > VM-1.xml Useful operation commands Create and start VM virsh define VM-1.xml virsh start VM-1 Shutdown VM virsh shutdown VM-1 Poweroff VM virsh destroy VM-1 Remove from VM list virsh undefine VM-1 Resize VM disk size qemu-img resize VM-1.img +60GB