2010
02.02

Remote operations on vmdk disks

Be the first to like.
Share

One of the local PCs is using VMware Player to run an (old and small) Windows 2000 Virtual Machine.
We need to expand its virtual disk but VMware Player lacks the tools to do that… I decided to see if it’s possibile to perform the expansion without moving the VM to a Server/ESXi/vSphere VMware host, using the commands (vmrun, vmware-vdiskmanager) that come along the VMware Workstation installation I’ve got on my Linux laptop. The VM is hosted on a Windows XP PC.
Here’s what I did:

  • Mount the host C$ share on the Linux laptop, using CIFS.
  • Unexpectedly, the VM has got some active snapshots. Since the whole snapshot machinery is not available in VMware Player, the VM should come out of a VMware Server/ESXi/vSphere host.
    # vmrun -T ws listSnapshots "Windows 2000 Professional.vmx"
    Total snapshots: 2
    Snapshot 1
    Snapshot 2
  • You can’t expand a disk that underwent some snapshots, they’ve got to be removed first:
    # vmrun -T ws deleteSnapshot "Windows 2000 Professional.vmx" "Snapshot 1"

    First caveat: the snapshot removal process causes vmrun to read/write large amount of data, depending on the snapshot’s size itself, I guess. You’re running it across the network: you’ll have to wait a while until it’s done. I’ve been monitoring the process with iftop -B -i eth0 -f ‘host hostname to have an estimate of how long it would take to complete. Each snapshot needs to be removed by means of vmrun.

  • Expansion time:
    # vmware-vdiskmanager -x 25GB "Windows 2000 Professional.vmdk"
      Grow: 100% done.
    Disk expansion completed successfully.

    WARNING: If the virtual disk is partitioned, you must use a third-party
             utility in the virtual machine to expand the size of the
             partitions. For more information, see:
             http://www.vmware.com/support/kb/enduser/std_adp.php?p_faqid=1647

    vmware-vdiskmanager appends X bytes of space (where X = new_capacity – previous_capacity) to the chosen vmdk. Again, those bytes travel through the network, be patient.

  • As vmware-vdiskmanager was so kind to remind us, we just expanded the disk, not the logical partitions contained therein. Some kind of partition manager software is needed to complete the job, my fav being Acronis Disk Director.

Summing things up, it’s indeed possible to operate remotely on vmdk disks. Did we save any time by doing things this way, that is without copying the VM “out” of its host then moving it back onto it? If the snaphots are more than one, no doubt that “local beats network”. And what about the expansion? If we add some (empty) data to a vmdk, then need to move it back to the host, then local shouldn’t be any faster than network. Better would be to use an external drive of sorts. Better yet is to temporarily copy/install VMware workstation on the host, or just vmrun/vmware-vdiskmanager executable files and their dependencies. That’s what I’ll try the next time.

Share