How to Use VMware's Virtual Disk Manager
- select the contributor at the end of the page -
- Create virtual disk files
- Edit virtual disk files
- Manage virtual disk files with scripts
- Defragment virtual disk files
- Expand virtual disk files
- Create disk templates
- Shrink virtual disks
In order to run the Virtual Disk Manager, you must open a command prompt and browse to the directory where you installed VMware Workstation (see Figure A). To execute the program type vmware-vdiskmanager.exe. The parameters to run this utility are shown in Table A below.
[caption id="attachment_11317" align="alignnone" width="677" caption="Figure A: VMware Virtual Disk Manager"][/caption]
Table A: VMware Virtual Disk Manger Options
Options | Description |
-c | Create disk; need to specify other create options. |
-d | Defragment the specified virtual disk. |
-k | Shrink the specified virtual disk. |
-n <source-disk> | Rename the specified virtual disk; need to specify destination disk name. |
-p | Prepare the mounted virtual disk specified by the drive letter for shrinking. |
-q | Do not log message. |
-r <source-disk> | Convert the specified disk; need to specify destination disk type. |
-x <new-capacity> | Expand the disk to the specified capacity. |
-a <adapter> | Adapter type (ide, buslogic, or lsilogic). |
-s <size> | Capacity of the virtual disk. |
-t <disk-type> | Disk type id. |
Disk Type: 0 | Single growable virtual disk. |
Disk Type: 1 | Growable virtual disk split in 2GB files. |
Disk Type: 2 | Preallocated virtual disk. |
Disk Type: 3 | Preallocated virtual disk split in 2GB files. |
How to Create a New Virtual Disk
We'll begin by using this utility to create a new virtual disk. In this example, let's create a 5GB IDE fixed virtual disk with the following command:
Vmware-vdiskmanager –c –s 5GB –a ide –t 2 ssw.vmdk
Virtual disks are created in the directory where VMware Workstation has been installed unless otherwise specified . If you want to create your virtual disk in a different directory use the following syntax, which specifies a location:
Vmware-vdiskmanager –c –s 5GB –a ide –t 2 "d:\my virtualmachines\test.vmdk"
The interface for creating virtual disks is very intuitive. Using the command line, you can create disks that are growable and/or preallocated. You can be as creative as you like using this interface to create disks. Let's move forward now and defrag a virtual disk. The command line for defragging a virtual disk is as follows:
VMware-vdiskmanager.exe –d "D:\My Virtual Machines\windows 2000 Advanced Server.vmdk"
In this example, we defragged a Windows 2000 Advanced server disk located in a different directory other than the default. Let's continue by changing the ssw.vmdk disk above from a preallocated disk to a dynamic growing disk. The syntax is as follows:
VMware-vdiskmanager.exe -r ssw.vmdk -t 0 sswgrowable.vmdk
Once you have attached the new disk within the VMware Control Center and tested the new disk with the applicable operating system, you can delete the old disk or vmdk file. At this point you should be feeling pretty comfortable and confident using this tool. Let's keep going and expand the preallocated 500Mb disk to 1Gb with the following syntax:
C:\Program Files\VMware\VMware Workstation>vmware-vdiskmanager -x 1gb "d:\my virtual machines\Windows_XP.vmdk"
Let's say at some point you want to shrink a virtual disk. This can be done by using the following syntax:
vmware-vdiskmanager.exe -k "d:\my virtual machines\windows 2000 advanced server.vmdk"
These examples should provide you with the basics to use this powerful utility. Let me know what you think?