[SOLVED] qm option to reattach unused disks

Although this is an old thread, I wanted to leave this useful tidbit:

Bash:
# The help command is informative
$ qm help rescan
USAGE: qm rescan  [OPTIONS]

  Rescan all storages and update disk sizes and unused disk images.

  -dryrun    <boolean>   (default=0)

             Do not actually write changes out to VM config(s).

  -vmid      <integer> (1 - N)

             The (unique) ID of the VM.

# Using this we can construct the rescan command with a dryrun to doublecheck
$ qm rescan --vmid [id] --dryrun
VM XXX add unreferenced volume 'storage:XXX/vm-XXX-disk-0.qcow2' as 'unused0' to config

# Now the real command
$ qm rescan --vmid [id]

[edit]

This command doesn't reattach, it adds the disks to your Hardware, where you can reattach by simply double clicking and "Add"ing.
 
Last edited: