LuXs Posted October 3, 2015 Share Posted October 3, 2015 How to shrink os x .vmdk in vmware workstation 12 As most people probably notice is that .vmdk file expands and never shrinks down back again it just gets bigger and bigger. The solution to fix this in vmware workstation 12 is this: Open terminal on your guest os OS X machine and run this command: Macintosh\ HD is the name of your harddrive so it might not be Macinthosh \HD for you so check that you type the correct name for your HardDrive. Use "sudo" instead of "su" if its yosemite or newer su diskutil secureErase freespace 0 Macintosh\ HD It will take some time and when it goes 90+% it will give you an error message that it ran out space and failed just ignore that and let it finish. When it has finished shutdown the Guest os and run this command in CMD (command prompt) as administrator on the main OS. path-of-vmware-folder\ vmware-vdiskmanager.exe -k path-of-virtual-machine\guest-name.vmdk Exampel of the one i had to use and dont forget the " " or you will get an error message and it wont start. C:\"Program Files (x86)\VMware\VMware Workstation\vmware-vdiskmanager.exe" -k "E:\Virtual Machines\OS X 10.9 Mavericks\OS X 10.9 Mavericks.vmdk" This will take some time also so but when its done your .vmdk will now be shrinked down to its real and correct size. I have added and changed so many files on my os x that it became 70gb+ in size but after running this it shrinked back down to just 10,4gb. The information was gathered from this blog but the commands he had didnt make vmware workstation 12 so it will look different from the blog and he didnt add su to the command and without it will stop. http://blog.oshim.net/2013/01/shrink-sparse-disk-image-of-mac-os-x.html 2 Link to comment Share on other sites More sharing options...
besweeet Posted October 3, 2015 Share Posted October 3, 2015 Ever since Yosemite came out, this has never worked for me. Same results now with El Capitan. Link to comment Share on other sites More sharing options...
LuXs Posted October 3, 2015 Author Share Posted October 3, 2015 I just did it on el capitan and i worked perfect from 17 gb down to 11gb.Did you write the command in guest os os x correct so it did the job there first and then the cmd in windows?Looks like you didn't run the command in OS X since it complains that the disk is full. I never get this error i just shrinking % and after some time it hits 100% and gives me: Shrink: 100% done. Shrink completed successfully Use the example i posted instead of going all the way into the program files folder and vmware workstation folder. The only difference i got in os x el capitan was that it didn't want to accept my password when i used "su" so i had to use "sudo" instead and then it worked like excpected.either you didn't do the commands correct or you have done something to the .vmdk file Link to comment Share on other sites More sharing options...
besweeet Posted October 3, 2015 Share Posted October 3, 2015 What does your Command Prompt output look like? Yes, the command within OS X was correct. http://www.insanelymac.com/forum/topic/292301-vmware-workstation-how-to-compresscleanup-vmdk/?do=findComment&comment=1949907used to work for me prior to Yosemite. Link to comment Share on other sites More sharing options...
LuXs Posted October 3, 2015 Author Share Posted October 3, 2015 Microsoft Windows [Version 6.1.7601] Copyright © 2009 Microsoft Corporation. All rights reserved. C:\Windows\system32>C:\"Program Files (x86)\VMware\VMware Workstation\vmware-vdi skmanager.exe" -k "C:\Users\LuX\Documents\Virtual Machines\OS X 10.11.0 El Capit an\OS X 10.11.0 El Capitan.vmdk" Shrink: 100% done. Shrink completed successfully. looks like this why did you enter the programs folder so many times? Link to comment Share on other sites More sharing options...
JJTagy Posted October 3, 2015 Share Posted October 3, 2015 @besweet: Perhaps your VM is not in C:\Users\Brian\Virtual Machines but instead in C:\Users\Brian\Documents\Virtual Machines ? Link to comment Share on other sites More sharing options...
besweeet Posted October 3, 2015 Share Posted October 3, 2015 @besweet: Perhaps your VM is not in C:\Users\Brian\Virtual Machines but instead in C:\Users\Brian\Documents\Virtual Machines ? no, it's actually in my user folder, not within Documents. Link to comment Share on other sites More sharing options...
JJTagy Posted October 3, 2015 Share Posted October 3, 2015 Ok, thought it was just forgotten. Not sure then. I just ran this process on my Yosemite build with no problems. Link to comment Share on other sites More sharing options...
LuXs Posted October 4, 2015 Author Share Posted October 4, 2015 It seems like something is wrong with your config file did you add a lot to it? You can just make a new VM so you just get a fresh config file and see if that works you of course change it so it matches the original file placement of the VM you want to shrink.Just look true the .vmx and vmxf and you should see those fields you need to change. Link to comment Share on other sites More sharing options...
besweeet Posted October 4, 2015 Share Posted October 4, 2015 It seems like something is wrong with your config file did you add a lot to it? You can just make a new VM so you just get a fresh config file and see if that works you of course change it so it matches the original file placement of the VM you want to shrink. Just look true the .vmx and vmxf and you should see those fields you need to change. I did add a few lines over the original VMX from a long time ago, but I don't think they'd prevent vmware-vdiskmanager from working properly. Here's my current VMX: http://pastebin.com/SC1dC616 Link to comment Share on other sites More sharing options...
AdnanNazir Posted December 3, 2015 Share Posted December 3, 2015 Hey there !I have tried this on My Mac OSX El Capitan running on Window 10!everything worked fine and I got success both from Guest and host system but I didn't see any improvements means I don't see any space free after all this !Can you guys help me out! How can I get this working Link to comment Share on other sites More sharing options...
Donk Posted December 3, 2015 Share Posted December 3, 2015 Simple way using VMware tools: sudo /Library/Application\ Support/VMware\ Tools/vmware-tools-cli disk shrink / You can repeat for any other mounted disks by replacing the "/" with the mount point. Please remember you cannot shrink disks with snapshots. Link to comment Share on other sites More sharing options...
AdnanNazir Posted December 3, 2015 Share Posted December 3, 2015 Hey Donk!I have tried the command you mentioned with no success !I mean the process works just fine and successful but I am not getting the space back. It just shrink the vmdk but the overall space that I have in guest OS doesn't getting increased ! Link to comment Share on other sites More sharing options...
Donk Posted December 3, 2015 Share Posted December 3, 2015 Hey Donk! I have tried the command you mentioned with no success ! I mean the process works just fine and successful but I am not getting the space back. It just shrink the vmdk but the overall space that I have in guest OS doesn't getting increased ! This thread is a not about freeing up space in the guest, it shrinks the virtual disk on the host. Link to comment Share on other sites More sharing options...
besweeet Posted December 3, 2015 Share Posted December 3, 2015 Hey Donk! I have tried the command you mentioned with no success ! I mean the process works just fine and successful but I am not getting the space back. It just shrink the vmdk but the overall space that I have in guest OS doesn't getting increased ! To free up space within the guest, you'd have to delete content from within the VM. Link to comment Share on other sites More sharing options...
AdnanNazir Posted December 3, 2015 Share Posted December 3, 2015 Ohhhh that's great ! so shriking virtual disk on host doesn't frees space in guest? Well, thats sounds ridiculous how'll the vmdk then actually shrink on host? Thanks besweet ! I have deleted to get space from the guest. Infact I don't think I am using more than 15-20GB but in my HardDrive info it gives only 4GB remaining!Can you help! how do I get my 15-20GB that's been lost in Bermuda triangle lol Link to comment Share on other sites More sharing options...
Donk Posted December 3, 2015 Share Posted December 3, 2015 Ohhhh that's great ! so shriking virtual disk on host doesn't frees space in guest? Well, thats sounds ridiculous how'll the vmdk then actually shrink on host? Thanks besweet ! I have deleted to get space from the guest. Infact I don't think I am using more than 15-20GB but in my HardDrive info it gives only 4GB remaining! Can you help! how do I get my 15-20GB that's been lost in Bermuda triangle lol It writes zeros to all the unused blocks on the virtual drive and then sends a command to the host VMware process to suspend the virtual machine, delete all zeroed block from the vmdk and then defragment the remaining blocks. It is the same as the manual process documented here. Link to comment Share on other sites More sharing options...
AdnanNazir Posted December 3, 2015 Share Posted December 3, 2015 Well thanks allot Donk for a pretty comprehensive answer!I'll try to figure that out where actually my extra storage space is been using. Link to comment Share on other sites More sharing options...
LuXs Posted December 4, 2015 Author Share Posted December 4, 2015 just use a disk inventory software for os x for that and it will tell you about where the space has been used.https://daisydiskapp.com/can be used Link to comment Share on other sites More sharing options...
conceptstom Posted December 7, 2015 Share Posted December 7, 2015 I' running into this problem when i try to expand my OS X(El Capitan) virtual machine diskspace on VMware 12 - on Windows 10. With Unlocker 2.07 I'm using TechReviews: https://www.youtube....h?v=qIINnuBRsmg - download link: https://goo.gl/2Lu9c6 I get this core dump: vcpu:-0:Verify vmcore/vmm/main/physmem_monitor.c:1178 And yes i've already added: smc.version = "0" to my VMX configuration file... What is wrong ??? Please i can't expand my OS X VM image: 40 GB preset in VMware is simply to small Regards Tom Link to comment Share on other sites More sharing options...
trungpt Posted April 14, 2016 Share Posted April 14, 2016 I see that there is an option to compact the hard disk when I select the Hard Disk within Hardware of the Virtual Machine Settings. I also check the documentation of VMware. I quote it here Compacting Virtual Hard Disks Compacting a virtual hard disk reclaims unused space in the disk. If a disk has empty space, this process reduces the amount of space the virtual hard disk occupies on the host drive. You must power off a virtual machine before you compact its virtual hard disk. Link to comment Share on other sites More sharing options...
LuXs Posted April 15, 2016 Author Share Posted April 15, 2016 yes but not for OS X VM only the OS that are supported out of the box like Microsoft Windows operating system not sure about linux havent tried to shrink a linux OS with the built in function. Link to comment Share on other sites More sharing options...
trungpt Posted April 17, 2016 Share Posted April 17, 2016 yes but not for OS X VM only the OS that are supported out of the box like Microsoft Windows operating system not sure about linux havent tried to shrink a linux OS with the built in function. I don't know that. Usually, I use it for all virtual machines. Link to comment Share on other sites More sharing options...
PippoX0 Posted April 17, 2016 Share Posted April 17, 2016 My alternative way to shrink VM disk 1. Create a new empty VM disk 2. Clone old VM Osx disk with Carbon Copy Cloner to new one. 3. Install bootloader Clover or Chameleon in new VM 4. Use New VM and delete old one Imo. I think that it is a faster way ... See Ya PippoX0 Link to comment Share on other sites More sharing options...
trungpt Posted April 18, 2016 Share Posted April 18, 2016 Hope that VMware will soon officially support this feature. Link to comment Share on other sites More sharing options...
Recommended Posts