VMDK Handbook - Tools
by
Ulli Hankeln
In emergencies visit
back to Table of Content
<<<
vmware-vdiskmanager
vmware-vdiskmanager comes with Workstation.
It is a powerful tool to create , convert and maintain vmdk-files.
Several of the vmware-vdiskmanager versions are buggy.
Known good : Workstation 6.0.5 and 6.5.3
Basic-operations:
-c : create disk. Enter size , adapter , disk-type and path to new
vmdk
-d : defragment .Enter local path to vmdk
-k : shrink . Enter local path to vmdk
-n : rename . Enter old and new path
-p : wipe : Enter driveletter of mounted vmdk
-r : convert . Enter source path , disk type , output path
-x : expand . Enter new size and path to vmdk
-R : repair . Enter path to vmdk
Latest version can create and convert this types:
0 : monolithicSparse
1 : twoGbMaxExtentSparse
2 : monolithicFlat
3 : twoGbMaxExtentFlat
4 : vmfs thick provisioned
5 : streamOptimized
6 : vmfs thin provisioned - only works if the
filesystem supports it
The capacity can be specified in sectors, KB, MB or GB.
Older versions have a size limit of 950 GB
Options for adapter :
-a ide : for IDE - disks
-a buslogic : older controller - use with guests that use the VMscsi
driver or for old guests
-a lsilogic : all the newer virtual controller use this
Options for remote disks :
-h : hostname of remote server
-u : username for remote server
-f : file containing password
-P : optional TCP port number (default: 902)
Expand a vmdk to the new size of 32 Gb
vmware-vdiskmanager -x 32Gb "C:\test area\small.vmdk"
A growable disk has errors - this tries to fix them.
vmware-vdiskmanager -R "C:\test area\kaputt.vmdk"
Create a 32 GB growable disk split in 2 Gb slices with adaptertype
lsilogic (twoGbMaxExtentSparse)
vmware-vdiskmanager -c -s 32GB -a lsilogic -t 1
"C:\test area\test.vmdk"
Convert a one piece growable vmdk into a preallocated one (monolithicFlat)
vmware-vdiskmanager -r growable.vmdk -t 1 preallocated.vmdk
You have a VM with a lot of snapshots and you are running out of diskspace
on C:\
Snapshotmanager can not operate anymore. As a temporary fix you add
a USB-disk mounted a U:\
Now you can consolidate the complete snapshot-chain into a new vmdk
with vdiskmanager with a command like this:
vmware-vdiskmanager -r "C:\vms\Windows XP\system-000023.vmdk"
-t 0 "U:\consolidated.vmdk"
Upload a vmdk to a ESXi and store it in thin provisioned format.
Note the echo command - it creates the passwordfile required to log
in to the ESXi - the actual command for vmware-vdiskmanager is all
in one line. Also see
how this can be used for P2V
echo myrootpassword > passwordfile
vmware-vdiskmanager -r "C:\vms\Windows XP\windows xp.vmdk"
-t 6 -h esxi.sanbarrow.local -u root -f passwordfile
"[datastore1000]/import/target.vmdk"
<<<
vmkfstools
Author : VMware - comes with ESX and ESXi
Download
Homepage
man-page
help-page
Example:
Export a vmdk from a local datstore to a NFS mounted datstore in growable
split format
vmkfstools -i /vmfs/volumes/localdatastore/test.vmdk
/vmfs/vol umes/nfsdatastore/export.vmdk -d 2gbsparse
<<<
vdk 32bit
Author : Ken Kato
Homepage
Download
vdk.exe is as far as I know the oldest mount-tool not created by VMware.
It is getting more and more outdated as it does not understand some
lines in new vmdk description.
It is still a very valuable tools as it can handle partly corrupt
vmdks that no other tool would accept.
It is a command line tool with easy syntax.
It can create snapshots.
Very nice: if it encounters new vmdks it offers to ignore unknown
description parameters
Examples:
Mount 3. partition of test.vmdk as Q: in readonly mode
vdk open 0 "C:\test area\test.vmdk /p:3 /l:Z:
Mount 3. partition of test.vmdk as Q: in writeable mode
vdk open 0 "C:\test area\test.vmdk /rw
/p:3 /l:Z:
Unmount the disk again
vdk close 0
<<<
vdk 64bit
Author : Gianluigi Tiesi alias Sherpya
Homepage
Download
This is a port of Ken Katos vdk.exe to 64bit Windows.
I rarely use it as I do all the recovery work on 32 bit systems -
so I can not say much about it.
<<<
vmware-mount
Author : VMware - part of the Virtual Disk Development Kit
Homepage
Download
The vmware-mount tool that comes with the VDDK is the first choice
when vmdks created by Vista and higher
have to be mounted.
Main operations:
/v:N mounts volume N of a virtual disk (default=1)
/d deletes the mapping to a virtual drive volume
/f forcibly deletes the mapping to a virtual drive volume
/p displays the partitions (volumes) on a virtual disk (local disks
only)
/L lists the currently-mounted volumes
Options
/i:InventoryPath inventory path of the VM owning the virtual disk
/m:[w|n] mount in read-'w'rite or 'n'on-persistent mode
/h:host name or address of server to access managed virtual disk
/u:userid user name on the server
/s:password password on the server
/P:port# port number to access the server (default=902)
/? displays short hep text
Examples:
Mount a local vmdk to driveletter Z:
vmware-mount z: "C:\test area\test.vmdk"
Mount a local vmdk to driveletter Z: in writeable mode
vmware-mount /m:w z:"C:\test area\test.vmdk"
Display partition info of a local vmdk
vmware-mount /L "C:\test area\test.vmdk"
Mount a vmdk on a remote ESX host.
You must give the path to the vmdk and specify the path to gthe VM
that owns it - this may be different !
vmware-mount z: "[storageX] MyVm/Disk1.vmdk"
/i:"ha-datacenter/vm/MyVm" /h:myesx.domain.com /u:userid
/s:password
<<<
imdisk
Author : Olof Lagerkvist
Homepage
Imdisk forum - a section at boot-land
The new kid on the block is imdisk. It has a very helpful author and
it is in rapid development.
If you need to do something really exotic with vmdks ask Olof at boot-land.
<<<
winimage
Author : Gilles Vollant
Homepage
Download
This is another must-have tool that comes with a GUI
<<<
vmrun
vmrun is a mini remote-control tool with a whole lot of options.
For this context I only list a few of the options.
vmrun can talk to different platforms - specify
-T ws for Workstation
-T esx for ESX
-T vc for VirtualCenter
-T server for VMserver2
-T server1 for VMserver1
start |
Path to vmx file [gui|nogui] |
stop |
Path to vmx file [hard|soft] |
reset |
Path to vmx file [hard|soft] |
suspend |
Path to vmx file [hard|soft] |
pause |
Path to vmx file |
unpause |
Path to vmx file |
|
|
listSnapshots |
Path to vmx file |
snapshot |
Path to vmx file |
deleteSnapshot |
Path to vmx file |
revertToSnapshot |
Path to vmx file |
|
|
list |
|
register |
Path to vmx file |
unregister |
Path to vmx file |
listRegisteredVM |
|
deleteVM |
Path to vmx file |
clone |
Path to vmx file - path to destinatio |
Examples:
Starting a virtual machine with Workstation on a Windows host
vmrun -T ws start "c:\my VMs\myVM.vmx"
Stopping a virtual machine on an ESX host
vmrun -T esx -h https://myHost.com/sdk -u hostUser
-p hostPassword stop "[storage1] vm/myVM.vmx"
Creating a snapshot of a virtual machine with Workstation
on a Windows host
vmrun -T ws snapshot "c:\my VMs\myVM.vmx"
mySnapshot
Reverting to a snapshot with Workstation on a Windows host
vmrun -T ws revertToSnapshot "c:\my VMs\myVM.vmx"
snapshotname
Deleting a snapshot with Workstation on a Windows host
vmrun -T ws deleteSnapshot "c:\my VMs\myVM.vmx"
snapshotname
<<<
vboxmanage
vboxmanage is a commandline tool that comes with recent versions of
VirtualBOX
It is very useful to create description files for physical disks.
The syntax to create a vmdk description for the first physical disk
is
vboxmanage internalcommands createrawvmdk -filename
"C:\test-area\physical.vmdk" \\.\PhysicalDrive0
Look up the disk number in diskmanagement first.
This command creates a vmdk that is almost compatible with VMware
- only minor differences exist.
It does not define the offset - so the extent description line looks
like.
RW 156296385 FLAT "\\.\PhysicalDrive0" 0
just add the offset 0 at the end of the line to make it VMware compatible.
RW 156296385 FLAT "\\.\PhysicalDrive0" 0
VirtualBOX vmdks also define this parameters that should be removed
when used with VMware
ddb.uuid.image=
ddb.uuid.parent=
ddb.uuid.modofication=
ddb.uuid.parentmodification=
dsfo.exe and dsfi.exe - included in the dsfok-tools
Author : Dariusz Stanislawek
Homepage
Download
or here
This two commandline tools are a must have for Windows-users.
They are required for all operations on embedded vmdk descriptions.
For convenience sake I simply copy them to system32 so that they are
in the path.
The two tools make a very nice couple - as they use the same syntax
- just with source and destination exchanged.
When you extracted something with dsfo.exe - you just need to change
one letter in the last command to re-inject it.
Usage:
dsfo <source> <offset> <size>
<destination>
dsfi <destination> <offset> <size> <source>
null size is interpreted as max possible input
negative size is calculated on current file size
negative offset is calculated from end of file
use "e" as offset to indicate end of file
use "$" as destination to check MD5 signature only
Examples:
Extract the description from a monolithicSparse vmdk and store it
as desc.txt
dsfo "C:\test-area\test.vmdk" 512 1024
"C:\test-area\desc.txt"
Inject an edited description into a monolithicSparse vmdk
dsfi"C:\test-area\test.vmdk" 512 1024
"C:\test-area\desc.txt"
Extract the magic sector from a monolithicSparse vmdk and store it
as magic.dat
dsfo "C:\test-area\test.vmdk" 0 512 "C:\test-area\magic.dat"
Inject the magic sector into a monolithicSparse vmdk
dsfi"C:\test-area\test.vmdk" 0 512 "C:\test-area\magic.dat"
Extract the embedded vmx-file from a vmsn-snapshot file
dsfo "C:\test-area\test-snapshot.vsn"
100 10000 "C:\test-area\test.vmx"
Extract the last 512 bytes from a file
dsfo "C:\test-area\file.dat" -512 0 "C:\test-area\extract.dat"
Extract the first sector of a physical disk
dsfo \\.\PHYSICALDRIVE0 0 512 "C:\test-area\sector1.dat"
Change the first sector of a physical disk
dsfi \\.\PHYSICALDRIVE0 0 512 "C:\test-area\sector1.dat"
Create an image of a physical disk and store it as diskimage-flat.vmdk
dsfo \\.\PHYSICALDRIVE0 0 0 "C:\test-area\diskimage-flat.vmdk"
Clone a flat vmdk into into physical disk 0
dsfi \\.\PHYSICALDRIVE0 0 0 "C:\test-area\diskimage-flat.vmdk"
Create a floppy-image of drive A:
dsfo \\.\a: 0 0 "c:\test-area\floppy.flp"
Write a floppy-image to drive A:
dsfo \\.\a: 0 0 "c:\test-area\floppy.flp"
Create a iso-image of the DVD in drive E:
dsfo \\.\e: 0 0 "c:\test-area\cdimage.iso"
Create MD5 checksum of file.dat
dsfo file.dat 0 0 $
<<<
fsz.exe - included in the dsfok-tools
Author : Dariusz Stanislawek
Homepage
Download
or here
fsz is a very useful tool to create vmdk files from scratch.
It can also be used to expand existing vmdks.
Size is given in bytes - so 1Gb = 1024 x 1024 x 1024 = 1073741824
bytes
Examples
Create a 1Gb large test-flat.vmdk
fsz test-flat.vmdk 1073741824
Expand an existing test-flat.vmdk to the new size of 32 Gb
fsz test-flat.vmdk 34359738368
<<<
dd
Author
Homepage
man-page
Recommended tool to extract embedded descriptions from vmdks on Linux
hosts
<<<
Starwind V2V Converter
Author : Starwind
Homepage
Download
Very useful Freeware : converts VHD or IMG to VMDK and vice versa
<<<
|