How to use the command `qm move disk` (with examples)

How to use the command `qm move disk` (with examples)

The qm move disk command is an alias of the qm disk move command in Proxmox VE, a virtualization management platform. This command allows you to move a virtual disk from one storage to another within a Proxmox VE environment. It is particularly useful when you need to optimize storage space usage or when you want to balance the load across different storage devices.

Use case 1: Move a virtual disk to a different storage

Code:

qm move disk <vmid> <oldstorage> <newstorage>
  • <vmid>: The ID of the virtual machine from which you want to move the disk.
  • <oldstorage>: The name of the storage where the disk is currently located.
  • <newstorage>: The name of the storage where you want to move the disk.

Motivation: When you are running out of space on a specific storage device, it becomes necessary to move virtual disks to a different storage location with more available space.

Explanation: This command takes three arguments: <vmid>, <oldstorage>, and <newstorage>.

  • <vmid> is the ID of the virtual machine from which you want to move the disk. You can find the VM ID by listing the virtual machines using the qm list command.
  • <oldstorage> is the name of the storage where the disk is currently located. You can see the available storages by running the qm config <vmid> command and looking for the virtioX device’s storage parameter.
  • <newstorage> is the name of the storage where you want to move the disk. The storage must already exist in your Proxmox VE environment.

Example output:

Moved disk 'virtio0' of VM '100' from storage 'local-lvm' to storage 'ceph-vm'.

Use case 2: Move a virtual disk to a different storage using a specific filename

Code:

qm move disk <vmid> <oldstorage> <newstorage> --filename <filename>
  • <filename>: The name to be used for the virtual disk file on the new storage.

Motivation: In certain scenarios, you may want to use a specific filename for the virtual disk file when moving it to a different storage device.

Explanation: This command is similar to the previous one, but includes an additional argument: --filename <filename>.

  • <filename> is the name to be used for the virtual disk file on the new storage. By default, the filename is generated automatically, but using this argument allows you to specify a specific filename.

Example output:

Moved disk 'virtio1' of VM '101' from storage 'local' to storage 'nfs' with filename 'my_virtual_disk.qcow2'.

Use case 3: Move a virtual disk and clone it simultaneously

Code:

qm move disk <vmid> <oldstorage> <newstorage> --clone

Motivation: Cloning a virtual disk while moving it to a different storage can be handy when you need to preserve the original disk intact and create a copy for other purposes.

Explanation: This command is the same as the first use case, but includes the --clone argument.

  • --clone indicates that the virtual disk should be cloned while being moved to the new storage. This allows you to preserve the original disk intact and create a copy on the destination storage.

Example output:

Moved and cloned disk 'virtio0' of VM '200' from storage 'local-zfs' to storage 'iscsi-target'.
Created new disk 'virtio1' on storage 'iscsi-target'.

Conclusion:

The qm move disk command in Proxmox VE provides a convenient way to move virtual disks within your virtualization environment. Whether you need to optimize storage space, balance storage load, or create disk clones, this command helps you manage your virtual machines efficiently.

Related Posts

How to use the command "case" in Bash (with examples)

How to use the command "case" in Bash (with examples)

The “case” command in Bash is a built-in construct that allows for creating multi-choice conditional statements.

Read More
How to use the command 'zm' (with examples)

How to use the command 'zm' (with examples)

The ‘zm’ command is a tool for managing articles of newspapers and blogs.

Read More
How to use the command 'snort' (with examples)

How to use the command 'snort' (with examples)

Snort is an open-source network intrusion detection system. It serves as a powerful tool for analyzing and detecting network traffic anomalies, attacks, and suspicious activities.

Read More