I installed Windows 10 on VMWare and I set its capacity as 60 gigabytes. Now I only want it to have 30 gigabytes and reclaim those 30 gigabytes for my mac. How do I change that?
-
First shrink the Windows aprtiton then the virtual hard disk file. What's the file extension of that virtual hard disk?– BiswapriyoCommented Jun 16, 2018 at 11:59
-
by default any virtualization software will use a dynamically grown HDD image. Check your vmdk, most certainly it won't be 60GB unless your data inside are almost 60GB or you accidentally set it as fixed size[– phuclvCommented Jun 16, 2018 at 13:56
-
@phuclv Yes it's dynamically allocates, but it's .vmdk– user28603Commented Jun 16, 2018 at 14:15
-
@Biswapriyo it's .vmdk– user28603Commented Jun 16, 2018 at 14:16
-
what do you mean? I asked you to check your vmdk file size. If it's really dynamically sized and already 60GB then there's no way you can reduce it unless you remove files in the VM and run compact– phuclvCommented Jun 16, 2018 at 14:21
3 Answers
You could use the free VMware vCenter Converter Standalone to convert from your VMWare image. After conversion disk will be shrinked.
-
1Welcome to Super User! Please read how to recommend software in answers, particularly the bits in bold; then edit your answer to follow the guidelines there. Thanks!– bertiebCommented Feb 12, 2019 at 11:55
It seems like there is no easy way to shrink VMware virtual disk. I ended up creating a new dynamic one with a desired size, booting from Ubuntu live CD with both old and new disks attached to a virtual machine and dd if=/dev/sda of=/dev/sdb
my way out. sda
is an old and sdb
is the new disk.
This is terribly slow, but there is no way this could have not worked.
You can use the C:\Program Files\VMware\VMware Workstation\vmware-vdiskmanager.exe command line utility to create a new VMDK file with the lower capaacity.
Assuming that the utility is in your path and you are in the directory with the VMDK, make sure that the virtual machine is powered off and then issue a command like this:
vmware-vdiskmanager.exe -r sourceDisk.vmdk -s 30GB -t 0 destinationDisk.vmdk
Then, backup sourceDisk.vmdk
, rename destinationDisk.vmdk
to sourceDisk.vmd
and confirm that everything works. (If it doesn't, you can simply restore the original VMDK file.)
Note that this does not touch the original VMDK file, it's only a VMDK copy that's created.
Also, this is not a sector-by-sector copy. All data is copied from the original, regardless of its location. Therefore, no data will be lost so long as the destination disk size is large enough to accommodate all of it.
In effect, copying the VMDK file to one that's smaller with this tool automatically performs a partition resize and a Compact during the process. This is safe because VMware is aware of its own virtual disk structure. It's the same underlying technology used by VMware Converter when it creates a cloned virtual machine with a differently sized disk.
-
1That sounds like a bad idea. Shrinking the physical medium without first shrinking the filesystem can seriously corrupt the filesystem. Just because less than 30 GB are used doesn’t mean all data is physically located on the first 30 GB.– Daniel BCommented Jun 16, 2018 at 15:05
-
2@DanielB I worked in technical support at VMware for over twelve years, and I assure you that this is safe. :) But in the worst case, you are not actually touching the original file—if anything goes wrong, it's only the copy that will be affected, and it's easily recovered from. When you copy the disk, it's the data that's copied—it's not sector by sector. In effect, a Compact is automatically performed during the process. Commented Jun 16, 2018 at 15:07
-