LinuxCommandLibrary

qm-disk

Manage Proxmox VM disk images

TLDR

Add n gigabytes to a virtual disk

$ qm [[di|disk]] [[resi|resize]] [vm_id] [disk_name] +[n]G
copy

Move a virtual disk
$ qm [[di|disk]] [[m|move]] [vm_id] [destination] [index]
copy

Delete the previous copy of the virtual disk
$ qm [[di|disk]] [[m|move]] --delete [vm_id] [destination] [index]
copy

Import a VMDK/qcow2/raw disk image using a specific storage name
$ qm [[di|disk]] [[i|import]] [vm_id] [path/to/disk] [storage_name] --format [qcow2|raw|vmdk]
copy

SYNOPSIS

qm disk command [options]

PARAMETERS

list [--vmid <VMID>] [--storage <STORAGE>]
    Lists all virtual machine disks. Optionally filters by VMID to show disks for a specific VM, or by STORAGE to show disks located on a particular storage.

resize <VMID> <DISK> <SIZE>
    Resizes a virtual machine disk. <VMID> specifies the VM, <DISK> identifies the disk (e.g., scsi0, sata0), and <SIZE> is the new size (e.g., 100G, +10G for growth). Note that online resize depends on the disk type and guest OS support.

move <VMID> <DISK> <TARGET_STORAGE> [--delete] [--format <FORMAT>]
    Moves a virtual machine disk to a different storage. <VMID> is the VM, <DISK> is the disk to move, and <TARGET_STORAGE> is the name of the destination storage. Use --delete to remove the source disk after a successful move. --format allows specifying the target image format (e.g., qcow2, raw).

image-id <VMID> <DISK>
    Retrieves the full image ID for a specified VM disk.

image-properties <IMAGEID>
    Displays detailed properties and configuration for a given disk image using its full IMAGEID.

DESCRIPTION

The qm disk command is a specialized subcommand of the Proxmox VE qm utility, providing comprehensive tools for managing virtual machine disk images. It centralizes and simplifies various disk-related operations that are crucial for efficient VM administration.

Administrators utilize qm disk to perform tasks such as:

  • Listing all attached VM disks across different storage types.
  • Resizing virtual disk volumes, allowing for dynamic adjustment of storage capacity.
  • Moving disk images between diverse storage backends (e.g., local, LVM, ZFS, NFS, iSCSI, Ceph), facilitating storage optimization and migration strategies.
  • Inspecting detailed properties of disk images.

This command is indispensable for maintaining the health, performance, and flexibility of virtualized environments within Proxmox VE, automating complex storage interactions.

CAVEATS

  • Context Specific: This command is part of Proxmox VE and is not available on standard Linux distributions without Proxmox installed.
  • Data Loss Risk: Operations like resize or move can lead to data loss if not used carefully, especially when combined with options like --delete. Always ensure backups before critical operations.
  • VM State: For certain operations, the VM may need to be shut down to prevent data corruption or ensure consistency.
  • Permissions: Requires appropriate Proxmox VE user permissions to execute disk management tasks.

DISK IDENTIFICATION

Virtual disks are typically identified by a combination of their controller type and index, such as scsi0, virtio0, sata0, or ide0. For standalone disk images not currently attached to a VM, or for operations requiring direct image reference, the full image ID (e.g., local-lvm:vm-100-disk-0) is used.

SUPPORTED STORAGE TYPES

qm disk can interact with disks residing on various Proxmox storage types, including: Local Directory, LVM, LVM-Thin, ZFS, NFS, iSCSI, and Ceph RBD. The behavior and capabilities of disk operations might vary slightly depending on the underlying storage technology.

HISTORY

The qm disk subcommand emerged as an evolution within the Proxmox VE project, aiming to consolidate and streamline complex virtual disk management tasks. Initially, many disk operations were performed indirectly through qm set or by directly manipulating files on underlying storage. The introduction of the dedicated disk subcommand provided a more intuitive, robust, and unified interface for administrators, significantly enhancing usability and simplifying the lifecycle management of VM storage within the Proxmox ecosystem. This development reflects Proxmox's commitment to providing comprehensive and user-friendly virtualization management tools.

SEE ALSO

qm(1), pct(1), pvesm(1), qemu-img(1)

Copied to clipboard