How to use the command qm migrate (with examples)

How to use the command qm migrate (with examples)

The qm migrate command is used to migrate a virtual machine from one Proxmox VE node to another. It allows users to move virtual machines across hosts to balance the load or perform maintenance without causing downtime. This command creates a new migration task and provides several options to customize the migration process.

Use case 1: Migrate a specific virtual machine

Code:

qm migrate 100 target_node

Motivation: Migrating a specific virtual machine is useful when you need to move a particular VM to another node for performance optimization or hardware maintenance.

Explanation:

  • qm migrate: The command to initiate the migration process.
  • 100: The ID of the virtual machine you want to migrate.
  • target_node: The name or IP address of the target node where you want to migrate the VM.

Example output:

Task 'Migrate' started successfully for VM 100

Use case 2: Override the current I/O bandwidth limit

Code:

qm migrate 100 target_node --bwlimit 10

Motivation: Overriding the current I/O bandwidth limit can be useful in scenarios where you want to prioritize the migration process or allocate a specific amount of bandwidth for the migration task.

Explanation:

  • --bwlimit 10: Overrides the current I/O bandwidth limit with a value of 10 KiB/s.
    • --bwlimit: Specifies the bandwidth limit to be used for the migration in KiB/s.
    • 10: The desired bandwidth limit to be applied.

Example output:

Task 'Migrate' started successfully for VM 100 with I/O bandwidth limit set to 10 KiB/s.

Use case 3: Allow migration of virtual machines using local devices

Code:

qm migrate 100 target_node --force true

Motivation: By default, Proxmox VE does not migrate virtual machines that use local devices. Enabling the --force option allows you to override this behavior and migrate VMs using local devices, providing more flexibility during the migration process.

Explanation:

  • --force true: Allows migration of virtual machines using local devices.
    • --force: Overrides the default restriction on migrating VMs using local devices.
    • true: Enabling the override and allowing the migration.

Example output:

Task 'Migrate' successfully started for VM 100 with local devices migration enabled.

Use case 4: Use online/live migration

Code:

qm migrate 100 target_node --online true

Motivation: Live migration allows you to migrate a virtual machine while it is still running, ensuring minimal downtime and uninterrupted service to users. This is especially crucial for critical systems or VMs that cannot be easily shut down.

Explanation:

  • --online true: Enables online/live migration for the virtual machine.
    • --online: Activates the online/live migration mode.
    • true: Indicates that online/live migration should be used.

Example output:

Task 'Migrate' started successfully for VM 100 with online/live migration enabled.

Use case 5: Enable live storage migration for local disks

Code:

qm migrate 100 target_node --with-local-disks true

Motivation: Live storage migration allows you to migrate virtual machine storage while the VM is still running. This can be beneficial when you need to balance the storage load or when your storage infrastructure requires maintenance or upgrades.

Explanation:

  • --with-local-disks true: Enables live storage migration for local disks.
    • --with-local-disks: Specifies that live storage migration should be performed for local disks.
    • true: Enables live storage migration for local disks.

Example output:

Task 'Migrate' started successfully for VM 100 with live storage migration for local disks enabled.

Conclusion:

The qm migrate command offers a wide range of options to facilitate the migration of virtual machines in Proxmox VE. Whether you need to migrate a specific VM, tune the I/O bandwidth limit, allow migration of VMs using local devices, perform live migration, or enable live storage migration for local disks, qm migrate provides the flexibility needed to seamlessly move virtual machines across nodes and ensure minimal downtime.

Related Posts

How to use the command graphml2gv (with examples)

How to use the command graphml2gv (with examples)

The graphml2gv command is part of the Graphviz package and is used to convert a graph from graphml format to gv format.

Read More
How to use the command lvcreate (with examples)

How to use the command lvcreate (with examples)

The lvcreate command is used to create logical volumes in an existing volume group.

Read More
Managing BetterDiscord with betterdiscordctl (with examples)

Managing BetterDiscord with betterdiscordctl (with examples)

BetterDiscord is a popular customization tool for the Discord chat platform, allowing users to enhance their experience with custom themes and plugins.

Read More