Carlos Aguni

Highly motivated self-taught IT analyst. Always learning and ready to explore new skills. An eternal apprentice.


Virsh Cheat Sheet

31 Oct 2022 »

list

virsh list

 Id   Name                State
-----------------------------------
 7    rocky8              running
 10   rocky8.6-template   running

start

virsh start <vm>

shutdown/suspend

virsh shutdown <vm>

virsh suspend <vm>

clone

virt-clone --original rocky8.6-template --name lab-otel --auto-clone

create vm

#!/bin/bash

virt-install \
  --name rocky8.6-template \
  --ram 8192 \
  --disk path=/var/lib/libvirt/images/rocky8.6-template.qcow2,size=80 \
  --vcpus 4 \
  --os-type linux \
  --os-variant generic \
  --console pty,target_type=serial \
  --bridge=br0 \
  --cdrom /var/lib/libvirt/images/Rocky-8.6-x86_64-minimal.iso