kvm-vm-tune

command module
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 6 Imported by: 0

README

kvm-vm-tune

kvm-vm-tune is a CLI tool for managing KVM virtual machine resources, including CPU, memory, and disk.

Features

  • Change CPU count for a VM
  • Modify memory size of a VM
  • Expand disk size for a VM
  • Create new disk images
  • Attach disks to VMs
  • Attach network interfaces to VMs
  • Dry-run option to preview commands without execution

Requirements

  • sudo privileges are required to run the commands.
  • The following tools must be installed on your system:
    • virsh
    • qemu-img
    • virt-resize

Usage

Change CPU count
$ kvm-vm-tune cpu <vm_name> --count <cpu_count>
Change memory size
$ kvm-vm-tune memory <vm_name> --size <memory_size>
Expand disk
$ kvm-vm-tune expand-disk <vm_name> --size <new_size> [--device <device>] [--partition <partition_number>] [--image <image_path>]
Create disk
$ kvm-vm-tune create-disk --path <disk_path> --size <disk_size> [--format <disk_format>]
Attach disk
$ kvm-vm-tune attach-disk <vm_name> --disk-path <disk_path> --target <target_device> [--cache <cache_mode>] [--driver <driver_type>] [--subdriver <subdriver_type>]
Attach network interface
$ kvm-vm-tune attach-iface <vm_name> --type <interface_type> --source <source_name> [--model <interface_model>]
Dry-run

Add the --dry-run flag to any command to preview the commands without executing them.

Examples

  1. Change CPU count to 4 for VM named "myvm":

    $ kvm-vm-tune cpu myvm --count 4
    
  2. Change memory size to 8G for VM named "myvm":

    $ kvm-vm-tune memory myvm --size 8G
    
  3. Expand disk size to 40G for VM named "myvm":

    $ kvm-vm-tune expand-disk myvm --size 40G
    
  4. Create a new 10G disk image in qcow2 format:

    $ kvm-vm-tune create-disk --path /var/lib/libvirt/images/newdisk.img --size 10G --format qcow2
    
  5. Attach the newly created disk to a VM:

    $ kvm-vm-tune attach-disk myvm --disk-path /var/lib/libvirt/images/newdisk.img --target vdb
    
  6. Attach a bridge network interface to a VM:

    $ kvm-vm-tune attach-iface myvm --type bridge --source br0 --model virtio
    
  7. Dry-run disk expansion:

    $ kvm-vm-tune expand-disk myvm --size 40G --dry-run
    

License

This project is licensed under the MIT License.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL