Convert a VMware hard drive image between single-file and split modes

When creating a VMware virtual machine, you have two choices as to the format of your hard drive file: a single expanding file, or split into many 2GB files.

Each type has its advantages and disadvantages. The single file is faster for larger disks, but can’t be used on FAT32 filesystems (4GB file size limit) and can get to be a challenge to move to another system once it starts getting really large. The split-file hard drive type is easier to move around and works on FAT32, but can suffer degraded performance when you get a very large drive of the files become fragmented. It’s also easier to manage backing up 2GB files rather than a single large file.

However, if you have a need, you can convert between the two types fairly easily. The following information is based on from a knowledge-base article at kb.vmware.com.

Before starting, make sure the VM is not running in Snapshot and is powered off.

To convert a single file to a split-file hard drive:

vmware-vdiskmanager -r  -t  

Type is one of:

  • 0 : single growable virtual disk
  • 1 : growable virtual disk split in 2GB files
  • 2 : preallocated virtual disk
  • 3 : preallocated virtual disk split in 2GB files

Example:

vmware-vdiskmanager -r winxp.vmdk -t 1 winxp-2.vmdk

Successful conversion gives the following output:

Creating disk 'winxp-2.vmdk'
Convert: 100% done.
Virtual disk conversion successful.

What you’ve just done is make a copy of the disk — the VM is still set to boot from the old disk image. In order to change this, simply edit the .vmx file for that VM in a text editor and change the line that pointed to your old .vmdk hard drive image to your new one.

Example:

ide0:0.fileName = "winxp.vmdk"

changes to

ide0:0.fileName = "winxp-2.vmdk"

Now you can save this file and power on your VM.

Please feel free to share questions, comments, or feedback in the comments section below. Thank you.

Advertisements