January 11

Linux: Mount Vmware .vmdk file on linux using vmware-mount

Do you have a large .vmdk file on an external HDD that you need to access to pick up some files and don’t want to mount it with  a virtual machine player? 

This quick tip assumes that you are familiar with virtualization and have basic Linux knowledge, but even if you are not, go on and read it, it is basic level and easy to implement.

Vmware Converter, to those who are not familiar with it,  is a tool produced by Vmware that will help you convert a physical machine to a VM (virtual machine), it is a very handy tool if you are running a Vmware datacenter, converting a Physical machine to a VM provides you with mobility for the machine that once was very hard to move or transfer, preserve old software that is running on old risky hardware, Moreover a nice feature is that the Hard Disk real size would be the size of the data inside it, i.e a physical machine that has a 1 TB HDD but has only a 70 GB data would have a VMDK file of 70 GB in size, of course i will not go in to the general benefits of virtualization.

Technically the converter converts that whole physical machine in to a software Hard Disk of type .vmdk which can be run on Vmware player, workstation,fusion,  ESXI, virtualbox… etc, but sometimes you just need to keep a backup of certain machine without deploying it on any player, and when the time comes that you need to pickup some data files from the machine without taking it the whole 9 yards and deploying it, here is where the tool that I will use is called Vmware-mount which is a part of the VDDK (Virtual Disk Development Kit) comes in hand.

The Virtual Disk Development Kit ( VDDK) is a collection of C/C++ libraries, code samples, utilities, and documentation to help you create and access VMware virtual disk storage. The VDDK is useful in conjunction with the vSphere API for writing backup and recovery software, or similar applications.(Vmware definition)

I will be showing the steps of how to mount the .vmdk from the linux terminal : I am using Ubuntu Desktop 14.04 LTS

1. VDDK Download:

If you already have an vmware account you can download the VDDK from the following  URL  or you can use this link URL if you wish, I have uploaded it to google drive in case you don’t have permission to download it, you would need to use a browser to download it,  I have chosen the 5.1 version, because when I installed the 5.5 version the tool that will be used wasn’t available, and  don’t worry you don’t need to worry  you can open the 5.5 version  vmdk with it.

2. VDDK installation:

  • The  downloaded VDDK is a gz tarball that can be extract with the following

tar xzvf %path/to/tar/nameoftar

  •  go in to the directory just created in the same directory and you would find the following perl script “vmware-install.pl”, the file is already executable, but in case it is not, use “sudo chmod +x vmware-install.pl

run by “sudo ./vmware-install.pl”

  • keep the defaults, the tools would be installed in the /usr/bin so you don’t need to go to the directory, you can just open the terminal and run vmware-mount
  • vmware-mount is like a regular mount, so you need to create a mount point/directory for example:”/mnt/vmwaremount”, this directory will be the destination folder in the commands below.
  • The vmdk used in this example is a typical ntfs windows multi-partition HDD

3. The commands that  you need:

vmware-mount -p /path/to/vmdk
This will list the paritions inside the vmdk, so you would know what partition number to choose.

vmware-mount /path/to/vmdk %partition#% /path/to/mountdirectory
example:
vmware-mount /media/saeed/seagatehdd/mountme.vmdk 2 /mnt/vmwaremount
This will mount the second partition in the vmdk in the mounting point “/mnt/vmwaremount”

Now after mounting the vmdk, you can easily go to the mount/point use the regular Linux commands like:

cd /mount/point
for example
cd /mnt/vmwaremount
ls, cd , cp would be handy from here on

or you can use the GUI to go to the mount directory as an alternative

after you have finished and need to un-mount the vmdk in order to eject the external HDD, in order to un-mount cleanly the vmdk ( be careful the the vmdk would be damaged and would need repair in case you disconnect without cleanly un-mounting the mounted partitions), in order to do that you would need to run the below commands, you would use the -d command on all the mounted points, and you would keep checking the status of the mounted HDD using the -L, as long as the return of the -L command is not empty it means that the vmdk still has a mounted point.

vmware-mount -L
this will displays all virtual disks mounted, but not the partitions

vmware-mount -d /mount/point
This will un-mount the partition
for example to un-mount the partition that we mounted above
vmware-mount -d /mnt/vmwaremount

By: S Khodor


Copyright 2021. All rights reserved.

Posted January 11, 2016 by Timothy Conrad in category "Linux

About the Author

If I were to describe myself with one word it would be, creative. I am interested in almost everything which keeps me rather busy. Here you will find some of my technical musings. Securely email me using - PGP: 4CB8 91EB 0C0A A530 3BE9 6D76 B076 96F1 6135 0A1B