How to Change a VMware Disk to Preallocated
When a virtual machine is configured in VMware, you have the option to preallocate disk space, or to simply set a limit and direct the virtual machine to only increase the amount of hard drive space consumed on the host computer when necessary. This minimizes the amount of space consumed by the virtual machine on your PC. However, a file that frequently grows and shrinks can also encourage fragmentation, harming the performance of the virtual machine. For best performance, convert a dynamic VMware disk to a preallocated one.
Things You'll Need
- VMware Workstation or Server
Copy the file representing the VMware disk to the main VMware folder. For example, if the name of the virtual machine is "Windows XP Professional," the VMware disk might be called "Windows XP Professional.vmdk." If you are using VMware Server, the default VMware installation directory is C:\Program Files\VMware\VMware Server.
Click in the address bar at the top of the window after copying the VMware disk into the VMware folder. The address bar at the top of the screen will change to the full path to the VMware installation folder. Highlight the path with the mouse pointer, then right click the highlighted text and click "Copy."
Press the Windows logo and "R" keys simultaneously to display the "Run" dialog box. Type "cmd" without quotation marks into the box and press "Enter" to bring up the command prompt.
Type "cd" in the command prompt, then press the space bar. Click the "C:\" icon in the upper left corner of the command prompt window, then click "Edit" and "Paste." The path of the VMware installation directory which was copied in Step 2 will be inserted. Press "Enter" to navigate to that directory.
Type "vmware-vdiskmanager -r (name of VMware disk) -t 2 (name of new disk)" and press "Enter." The name of the VMware disk should be the exact name of the file that you copied in Step 1, ending with ".vmdk." The name of the new disk can be anything you like, but it should also end with ".vmdk." This process creates a new file. The new file contains all of the information from the original VMware disk, but the space is preallocated. Note that if the hard drive in your computer is formatted with the FAT32 file system, it is unable to address a file larger than 2 GB. In this case, enter "-3" when typing this command rather than "-2." This creates a preallocated disk that is split into 2 GB files.
Copy the new file into the folder where the virtual machine is located. The original disk that you copied into the VMware installation directory can be deleted. The original disk can also be deleted from the folder where the virtual machine is located after you confirm that the preallocated disk works properly.
Launch VMware. Right click the virtual machine that you have performed the conversion on, and click "Edit VM."
Click the original disk on the device list, then click the "Remove" button.
Click the "Add" button. Click "Hard Disk" in the window that appears, then click "Next."
Click "Use an existing virtual disk" and click "Next."
Click the "Browse" button. Navigate to the new file that you created when performing the conversion, and double click it.
Click "Finish." You may now resume using the virtual machine.