0

In VirtualBox I have been using the command:

VBoxManage.exe modifymedium disk disk.vdi --compact

In order to reduce the size of .vdi files after running zerofree. I'd like to do the same for vSphere virtual disks using pyVmomi. I've seen you can use the command

vmkfstools --punchzero disk.vmdk

But this seems to require ESXi host shell access which I don't have.

Keeely
  • 895
  • 9
  • 21
  • Python scripts can run other executables using the built-in [`subprocess`](https://docs.python.org/3/library/subprocess.html#module-subprocess) module (and pass arguments to them). Doing so doesn't necessary invoke the shell. – martineau Aug 23 '19 at 14:52
  • @martineau What I meant was, I don't have access to run vmkfstools on the host in question, so I need to do it through the API. subprocess module won't help. I've updated the description in case it wasn't clear. – Keeely Aug 23 '19 at 15:02

0 Answers0