qm-move_disk
Move virtual machine disk images
TLDR
View documentation for the original command
SYNOPSIS
qm move_disk <vmid> <diskid> <target-storage> [OPTIONS]
PARAMETERS
<vmid>
The unique ID of the virtual machine whose disk is to be moved.
<diskid>
The identifier of the disk to move (e.g., scsi0, ide0, virtio0). This must match the disk ID in the VM's configuration.
<target-storage>
The name of the Proxmox storage pool or backend where the disk should be moved.
--bwlimit <integer>
Limits the bandwidth for the disk move operation in KiB/s. Useful to prevent saturation of network or storage resources during the transfer.
--delete <boolean>
Specifies whether to delete the original disk volume after a successful move. Defaults to true (1). Use with caution.
--discard <boolean>
Enables or disables discard (TRIM) support on the target volume. Defaults to true (1) if the target storage supports and has discard enabled.
--format <string>
Specifies the target disk image format. Valid values are raw and qcow2. If not specified, the format is often derived from the target storage type or attempts to retain the original.
--sparse <boolean>
Creates the new volume as a sparse volume if the target format and storage support it. Defaults to false (0).
--target-disk <string>
Specifies a new disk ID for the target disk (e.g., changing scsi0 to scsi1). If not specified, the original disk ID is reused.
--target-volume <string>
Allows specifying a specific volume ID on the target storage. This option is primarily for internal use cases.
DESCRIPTION
qm move_disk is a subcommand of the Proxmox VE qm utility. It allows an administrator to move a virtual machine's disk image from its current storage location to a different storage backend configured within Proxmox VE. This operation typically requires the virtual machine to be stopped to ensure data integrity and avoid corruption. It is widely used for various administrative tasks such as rebalancing storage usage across different storage types (e.g., local storage to shared storage like Ceph or NFS), changing disk image formats (e.g., raw to qcow2), or preparing a VM's disk for migration to another host. The command handles the data transfer and automatically updates the VM's configuration to reflect the new disk location and parameters, simplifying complex storage management tasks.
CAVEATS
The virtual machine must generally be stopped before attempting to move a disk with qm move_disk to prevent data corruption and ensure a consistent state. Live disk migration is not supported by this specific command.
Ensure that the target-storage has sufficient free space to accommodate the disk, especially if converting from a sparse format to a thick-provisioned one.
The --delete option defaults to true. Always double-check your command to avoid accidental data loss of the original disk.
The command only supports converting between raw and qcow2 formats explicitly. Other format changes are handled implicitly by the storage backend (e.g., LVM volumes).
AUTOMATIC CONFIGURATION UPDATE
Upon successful completion of the disk move, qm move_disk automatically updates the virtual machine's configuration file to reflect the new disk location and parameters on the target storage. This ensures the VM can start correctly with its disk in the new location.
STORAGE BACKEND COMPATIBILITY
The command intelligently handles conversions and transfers between different types of Proxmox storage backends. For instance, you can move a disk from a local LVM storage to a network-attached NFS share, or from a local ZFS pool to a distributed Ceph RBD volume, with the utility managing the underlying complexities.
HISTORY
qm move_disk is a fundamental feature within the Proxmox VE ecosystem, integrated into the qm utility since early versions. Its development has closely tracked the evolution of Proxmox's support for diverse storage backends (such as ZFS, LVM, Ceph, NFS, and iSCSI), providing administrators with flexible tools to manage and optimize VM storage. It remains a crucial command for rebalancing, consolidating, and preparing VM disks for various operational needs within a Proxmox cluster.