Enterprise SONiC Bootcamp Register Now

Sign Up

KVM Cheat Sheet

Unlock the power of KVM with key commands to sharpen your virtualization and networking expertise. Whether you’re just starting or an experienced user, this resource will guide you in managing virtual machines effectively.
Dive in and start learning today!

KVM Cheat Sheet Commands

System administrators and network engineers frequently use essential KVM commands to handle virtualization tasks efficiently and maintain uninterrupted system performance.

To help streamline your workflow, we’ve compiled a comprehensive KVM Cheat Sheet for managing virtual machines and environments. No need to search online for KVM commands—everything you need is right here. This cheat sheet will assist you in performing configuration and management tasks efficiently, just like other popular resources for platforms such as Proxmox, VMware, or Hyper-V.
KVM logo

Basics

Basics

List all VMs, including running, stopped VMs
Start a specific virtual machine
Gracefully shutdown a virtual machine
Forcefully stop a virtual machine
Reboot a virtual machine
Suspend a running VM
Resume a suspended VM
Unregister a VM without deleting its disk image

Define a new VM from an XML configuration file
Edit a VM’s XML configuration file
Enable a VM to start automatically on boot
Disable autostart for a VM
Access the console of a running VM
Show detailed information about a VM
Check the current state of a virtual machine
List block devices (disks) used by the VM

Managing Storage

Networking

List all storage pools
List volumes in a storage pool
Create a new storage pool (e.g., dir, lvm, etc.)
Start a storage pool
Set a storage pool to start on boot
Create a new volume in a storage pool
Delete a volume from a pool

List all virtual networks
Start a virtual network
Stop a virtual network
Define a new virtual network from an XML file
Edit an existing network configuration
Enable a network to start automatically on boot
Disable autostart for a virtual network

Managing Snapshots

Disk and Block Devices

Create a snapshot of a VM
List all snapshots of a virtual machine
Revert to a previous snapshot
Delete a snapshot

Attach a disk to a VM (target: e.g., vdb, hda)
Detach a disk from a VM
Get info on block devices (disks)

Miscellaneous

Useful Flags

Create a snapshot of a VM
List all snapshots of a virtual machine
Revert to a previous snapshot
Delete a snapshot

Apply changes without rebooting the VM
Apply changes permanently (requires reboot)
Force an action (use with caution)
Provide detailed information for the command

Monitoring and Resource Management

Performance Tuning

View CPU usage of a VM
View memory usage of a VM
View all resource allocations for a VM
View real-time resource usage (vCPU, memory, I/O, etc.)
Monitor block I/O usage
Monitor network I/O usage
Show all vCPUs allocated to a VM

Set CPU pinning for a VM (bind vCPUs to physical CPUs)
Change memory allocation for a running VM
Change number of vCPUs for a running VM

KVM logo

What is KVM?

Proxmox is an open-source virtualization platform that integrates KVM and LXC technologies, enabling the management of virtual machines and containers. It features a web-based interface for easy deployment, scaling, and orchestration of workloads. With support for high availability, live migration, and backups, Proxmox is ideal for optimizing IT infrastructure in both enterprise and personal environments.

KVM Configuration Files

Proxmox VE utilizes a variety of configuration files to manage the virtualization environment effectively. Below are key aspects to consider when working with these files:

  • Networking: Use VLANs for traffic segmentation, bridged networking for VM communication, and NIC bonding for redundancy.
  • Storage: Choose ZFS (data integrity), Ceph (HA), or LVM (speed). Enable ZFS compression, use thin provisioning, and schedule snapshots.
  • Resource Management: Enable memory ballooning, use CPU pinning and NUMA, limit backup bandwidth, and set swappiness to 1.
  • Backup: Use Proxmox Backup Server for deduplicated backups, automate backups, and regularly test restores.
  • Performance: Use VirtIO drivers, enable SSD TRIM, set disk cache to “Writeback,” and ensure CPU virtualization (VT-x/AMD-V).
  • Security: Enable 2FA, isolate admin networks, use Proxmox firewalls, and restrict SSH to key-based login.
  • Clustering: Enable HA for critical VMs, monitor clusters with pvecm status, and ensure quorum with odd node counts.
  • Troubleshooting: Check logs, unlock stuck VMs with qm unlock <vmid>, and monitor disk IO to avoid bottlenecks.

Understanding these tips and applying them effectively will help you manage your Proxmox environment for improved performance, security, and reliability.

GNS3 Knowledge Base

Discover a wealth of information and expert tips in our GNS3 Knowledge Base, your go-to resource for mastering network simulations. Whether you need detailed tutorials, expert tips, or troubleshooting advice, our Knowledge Base has everything to enhance your skills and solve any challenges. Dive in now to enhance your skills and troubleshoot any challenges with ease!

Share the Knowledge: Spread the Word About Our KVM Cheat Sheet!

If you find this page helpful for your networking knowledge and skills, please consider sharing it with your friends, colleagues, and social media followers. Your support helps us create more valuable resources and enhance our courses.

You can share this page on your social media accounts like Facebook, LinkedIn, Twitter, and any related networking and programming forums or blogs. By sharing, you assist other networking enthusiasts in their learning journey, making their work easier and more efficient. So, if you’d like to help others, kindly share this page.

For more in-depth networking knowledge, visit our route2open courses.

The KVM logo was designed by the open-source community and is licensed under the Creative Commons Attribution-ShareAlike 3.0 License.

KVM Cheat Sheet!

Simply provide us with your name and email address, and we’ll send you our cheat sheet straight to your inbox