[SOLVED] List ESXi disks? (or where is source for qm import?)

etfz

New Member
Aug 29, 2025
9
1
3
Hi,

How can I list the disks of a virtual machine in an ESXi storage? I want to skip them for the import, and instead create placeholder disks, but that obviously requires me knowing which disks exist.
 
Hi,

assuming you're using the web gui: select the vm for import and in Advanced tab disable the ones you do not want to import.
1759478738781.png

On CLI: The ESXi storage is mounted at the PVE node at /run/pve/import/esxi/<storage-name>/mnt/ha-datacenter/<datastore-on-ESXi>/
Have a look at the subfolders for each vm to find the vmdk files you're interested in. Or parse the vmx-file of the vm for the disks. Entries of each disk might look like this:
scsi0:0.deviceType = "scsi-hardDisk"
scsi0:0.fileName = "Windows Server 2025.vmdk"

As I have only simple setup for VMware ESXi there might be differences to what I wrote caused by the various options and storages available.
 
Last edited:
Sorry. No, I am in fact looking for a CLI solution. I have a hacky solution for skipping them during import, but I need to enumerate them in order to create new disks.
 
Last edited:
another cli option:
put the password of ESXi root user in a file e. g. esxi-pass
then run
/usr/libexec/pve-esxi-import-tools/listvms.py <ESXi ip/host> root esxi-pass --skip-cert-verification > /tmp/vms.json
then use jq for accessing and filtering the data.
 
Thanks!

There could exist unused disks, so I can't simply list the disk files. Parsing VMX might work.

I also found this, which seems to be what qm import (and the web UI) uses:
Code:
pvesh get /nodes/NODE/storage/STORAGE/import-metadata --volume VOLUME_ID
 
  • Like
Reactions: fba
The API approach (e.g. with pvesh) is probably the best approach. If you are unsure which calls are of interest, do the procedure via the web UI and take a look at the browser's developer tools, especially the network tab, to see which API calls are involved in each step.
 
  • Like
Reactions: fba and etfz