LinuxCommandLibrary

qm-rescan

Rescan storage for VMs and containers

TLDR

Rescan all storages and update disk sizes and unused disk images of a specific virtual machine

$ qm rescan [vm_id]
copy

Perform a dry-run of rescan on a specific virtual machine and do not write any changes to configurations
$ qm rescan --dryrun [true] [vm_id]
copy

SYNOPSIS

qm rescan

PARAMETERS

VMID
    The ID of the virtual machine to rescan. This is a numerical identifier assigned to each VM within Proxmox VE.

DESCRIPTION

The `qm-rescan` command is a utility used within Proxmox VE to trigger a rescan of QEMU virtual machine disks. This is particularly useful after making changes to the underlying storage, such as resizing logical volumes or adding new disks to a storage pool. Without a rescan, the Proxmox VE host might not be aware of these changes, leading to incorrect disk sizes being displayed or an inability to access newly added storage. This command essentially instructs QEMU to re-enumerate the disks attached to a particular VM, forcing it to recognize the updated disk geometry and any newly available storage. It ensures that the guest operating system within the virtual machine can properly utilize the modified storage, and Proxmox VE reflects the actual disk state. It avoids restarting the vm to get the correct sizes of the disks in the os.
It's a very important command for storage administration.

CAVEATS

The command only rescans the disk configuration and does not modify the guest operating system in any way. The guest OS must still detect and use the added/resized storage by itself (e.g., by scanning for new disks or resizing partitions).

USAGE EXAMPLES

To rescan the disks of a virtual machine with ID 100, run:
`qm rescan 100`

TROUBLESHOOTING

If the rescan does not appear to be effective, ensure that the underlying storage changes have been properly applied (e.g., LVM resizing, ZFS pool expansion). Also, check the QEMU logs for any errors during the rescan process.
Sometimes the guest os does not have the correct drivers.

HISTORY

The `qm-rescan` command has evolved as a crucial part of Proxmox VE's storage management capabilities. Early versions of Proxmox VE often required restarting VMs to recognize changes in the underlying storage. The introduction of `qm-rescan` provided a more convenient and less disruptive way to update the virtual machine's disk configuration without incurring downtime. It's development was centered around improving efficiency and avoiding unnecessary VM reboots in dynamic storage environments.

SEE ALSO

qm(1), lvresize(8), pvresize(8), rescan-scsi-bus.sh(8)

Copied to clipboard