☰ Categories

Proxmox: Basic vm migrate command from cli

To migrate a VM from one Proxmox host to another from the command line, use the qm migrate command. Here's how to do it:
1. Basic Syntax

qm migrate <VMID> <target-node>

    <VMID>: ID of the virtual machine (e.g., 101)

    <target-node>: The hostname (as known by the Proxmox cluster) of the destination Proxmox server

2. Example

qm migrate 101 pm2

This will:

    Live migrate the VM if possible

    Otherwise, do an offline migration if live migration isn’t supported

3. Options

    --online: Force live migration

    --with-local-disks: Include local disks in the migration

    --targetstorage <storage>: Specify target storage if the storage names differ.

4. Note that you must be logged on the host that has the vm on it.  This unfortunately is not a "cluster" type command.