Modern, concise CLI for interactive Hyper2KVM workflows following the kubectl naming pattern
h2kvmctl (Hyper2KVM Control) is the primary command for interactive CLI and command-line usage, designed to provide a modern, concise interface following established patterns from kubectl, helmctl, and similar tools.
Hyper2KVM provides two commands serving complementary purposes:
h2kvmctl - Primary for interactive CLI workflows
hyper2kvm - Primary for daemon mode and services
hyper2kvm daemon)Neither is deprecated - both are actively maintained and serve different use cases.
hyper2kvm (saves typing)*ctl naming patternh2kvm + ctl)Both h2kvmctl and hyper2kvm are installed together:
# Install via pip
pip install hyper2kvm
# Both commands are now available
h2kvmctl --version # For interactive CLI usage (recommended)
hyper2kvm --version # For daemon mode and services
Important: h2kvmctl and hyper2kvm are functionally identical - they call the same Python function with zero performance difference.
# These work exactly the same for CLI usage
h2kvmctl --config migration.yaml
hyper2kvm --config migration.yaml
# Same for all operations
h2kvmctl --cmd local --vmdk /vms/vm.vmdk
hyper2kvm --cmd local --vmdk /vms/vm.vmdk
# Same for TUI
h2kvmctl-tui
hyper2kvm-tui
When to use which:
h2kvmctl --config migration.yaml (shorter, clearer)hyper2kvm daemon --config daemon.yaml (traditional daemon naming)hyper2kvm in ExecStart (daemon convention)# Create config
cat > migration.yaml <<EOF
command: local
vmdk: /vms/centos7.vmdk
output_dir: ./out
to_output: centos7.qcow2
out_format: qcow2
compress: true
fstab_mode: stabilize-all
regen_initramfs: true
EOF
# Run migration
sudo h2kvmctl --config migration.yaml
# Fetch and convert from ESXi
sudo h2kvmctl --config fetch.yaml
fetch.yaml:
command: fetch-and-fix
host: 192.168.1.100
user: root
identity: ~/.ssh/id_rsa
remote: /vmfs/volumes/datastore1/vm/vm.vmdk
output_dir: ./migrated
to_output: vm.qcow2
# Fix running VM without downtime
sudo h2kvmctl --config live-fix.yaml
live-fix.yaml:
command: live-fix
host: production-vm.example.com
user: root
identity: ~/.ssh/id_rsa
fstab_mode: stabilize-all
regen_initramfs: true
# Migrate multiple VMs in parallel
sudo h2kvmctl --config batch.yaml
batch.yaml:
command: local
batch_manifest: vms.json
batch_parallel: 3
batch_continue_on_error: true
output_dir: ./batch-output
All commands work identically with h2kvmctl:
| Command | Description | Example |
|---|---|---|
local |
Convert local VMDK | h2kvmctl --cmd local --vmdk vm.vmdk |
migrate |
Alias for local |
h2kvmctl --cmd migrate --vmdk vm.vmdk |
fetch-and-fix |
Remote ESXi fetch | h2kvmctl --config fetch.yaml |
ova |
Extract OVA | h2kvmctl --cmd ova --ova vm.ova |
ovf |
Extract OVF | h2kvmctl --cmd ovf --ovf vm.ovf |
vhd |
Convert VHD | h2kvmctl --cmd vhd --vhd vm.vhd |
ami |
Extract AMI tarball | h2kvmctl --cmd ami --ami ami.tar.gz |
raw |
Convert raw image | h2kvmctl --cmd raw --raw disk.img |
live-fix |
SSH-based fixing | h2kvmctl --config live.yaml |
libvirt-xml |
Parse libvirt XML | h2kvmctl --cmd libvirt-xml --xml vm.xml |
vsphere |
vSphere operations | h2kvmctl --config vsphere.yaml |
azure |
Azure migration | h2kvmctl --config azure.yaml |
daemon |
Watch directory | h2kvmctl --config daemon.yaml |
generate-systemd |
Generate unit file | h2kvmctl --cmd generate-systemd |
Launch the Terminal User Interface:
# Primary command (recommended)
h2kvmctl-tui
# Legacy command (still works)
hyper2kvm-tui
The TUI provides:
Existing automation continues to work - both commands coexist:
# Old scripts using hyper2kvm - still work!
hyper2kvm --config migration.yaml # ✅ Works
# New scripts using h2kvmctl - recommended
h2kvmctl --config migration.yaml # ✅ Works
hyper2kvm (no changes needed)h2kvmctl (modern, concise)h2kvmctl# 1. Create config
vim migration.yaml
# 2. Run migration
sudo h2kvmctl --config migration.yaml
# 3. Verify output
ls -lh ./out/
# 4. Import to libvirt
virsh define ./out/vm.xml
virsh start vm
# 1. Create batch manifest
cat > batch.json <<EOF
{
"migrations": [
{"vmdk": "/vms/vm1.vmdk", "to_output": "vm1.qcow2"},
{"vmdk": "/vms/vm2.vmdk", "to_output": "vm2.qcow2"},
{"vmdk": "/vms/vm3.vmdk", "to_output": "vm3.qcow2"}
]
}
EOF
# 2. Create batch config
cat > batch.yaml <<EOF
command: local
batch_manifest: batch.json
batch_parallel: 3
output_dir: ./batch-out
EOF
# 3. Run batch migration
sudo h2kvmctl --config batch.yaml
# 1. Setup SSH key access to ESXi
ssh-copy-id root@esxi-host
# 2. Create fetch config
cat > fetch.yaml <<EOF
command: fetch-and-fix
host: esxi-host
user: root
remote: /vmfs/volumes/datastore1/vm/vm.vmdk
output_dir: ./fetched
to_output: vm.qcow2
fstab_mode: stabilize-all
regen_initramfs: true
EOF
# 3. Fetch and convert
sudo h2kvmctl --config fetch.yaml
h2kvmctl for CLI, hyper2kvm for daemons (but both work anywhere)no_backup carefullyh2kvmctl --cmd local \
--vmdk /vms/centos7.vmdk \
--output-dir ./out \
--to-output centos7.qcow2 \
--compress
command: local
vmdk: /vms/windows-server-2019.vmdk
output_dir: ./out
to_output: windows-server.qcow2
out_format: qcow2
# Windows-specific
windows: true
virtio_drivers_dir: /usr/share/virtio-win
# Fixes
fstab_mode: stabilize-all
compress: true
libvirt_test: true
sudo h2kvmctl --config windows.yaml
# Preview without making changes
sudo h2kvmctl --config migration.yaml --dry-run -vv
# Create systemd service for daemon mode
sudo h2kvmctl --cmd generate-systemd \
--systemd-output /etc/systemd/system/hyper2kvm-daemon.service
# Show help
h2kvmctl --help
# Show version
h2kvmctl --version
# Dump config (debug)
h2kvmctl --config migration.yaml --dump-config
# Dump parsed args (debug)
h2kvmctl --config migration.yaml --dump-args
| Feature | h2kvmctl | hyper2kvm |
|---|---|---|
| Primary Use | Interactive CLI work | Daemon mode & services |
| Length | 8 chars | 12 chars |
| Performance | Identical | Identical |
| Functionality | 100% same | 100% same |
| Recommended for | Command-line migrations | Systemd services, daemons |
| Deprecation | Never | Never |
| Pattern | kubectl-style | Traditional daemon naming |
| Status | Active | Active |
Verdict:
h2kvmctl for interactive CLI work (shorter, modern)hyper2kvm for daemon mode and systemd services (traditional daemon naming)# After pip install, if command not found:
pip show hyper2kvm # Verify installation
which h2kvmctl # Check if in PATH
# Development mode:
./h2kvmctl --version # Use local wrapper
# Most operations need root/sudo
sudo h2kvmctl --config migration.yaml
# Check permissions
ls -l /vms/vm.vmdk
# Use absolute path
sudo h2kvmctl --config /full/path/to/migration.yaml
# Or relative to current directory
sudo h2kvmctl --config ./migration.yaml
/examples/yaml/Last Updated: January 2026 Command Status: ✅ Production Ready Supported Versions: Python 3.10+, All platforms