Shrink guest on hosted platform: Difference between revisions

m
no edit summary
mNo edit summary
Line 31: Line 31:
When you use the "Clean Up Disks" option in the menu in VMware Workstation 14 then you do not require extra disk space for reclaiming space (see also: [https://docs.vmware.com/en/VMware-Workstation-Pro/14.0/com.vmware.ws.using.doc/GUID-421A1073-BF16-4BC7-AA76-46B954CA438D.html Clean Up a Virtual Hard Disk on Windows Hosts] ) but I'm not sure that that works for Linux guests.
When you use the "Clean Up Disks" option in the menu in VMware Workstation 14 then you do not require extra disk space for reclaiming space (see also: [https://docs.vmware.com/en/VMware-Workstation-Pro/14.0/com.vmware.ws.using.doc/GUID-421A1073-BF16-4BC7-AA76-46B954CA438D.html Clean Up a Virtual Hard Disk on Windows Hosts] ) but I'm not sure that that works for Linux guests.


==== Zero out unused space in a Linux VM ====
== Zero out unused space in a Linux VM ==


Before we try to shrink the virtual disk files, we should try to remove any unneeded files from the virtual machine to free space.  
Before we try to shrink the virtual disk files, we should try to remove any unneeded files from the virtual machine to free space.  
Line 64: Line 64:
  cat /dev/zero > /home/zero.fill;sync;sleep 1;sync;rm -f /home/zero.fill
  cat /dev/zero > /home/zero.fill;sync;sleep 1;sync;rm -f /home/zero.fill


===== Zero out a part of your disk =====
=== Zero out a part of your disk ===


If your machine cannot be taken down and you do not want to shut down services that might end up corrupting files because of the "No space left on the device" problem then an idea that might work is to zero out a part of your partition.
If your machine cannot be taken down and you do not want to shut down services that might end up corrupting files because of the "No space left on the device" problem then an idea that might work is to zero out a part of your partition.
Line 85: Line 85:
If this is not for you, then do read on.
If this is not for you, then do read on.


==== Zero out unused space on a Windows VM ====
== Zero out unused space on a Windows VM ==


To do the same with a windows VM, you can use Microsoft's tool [http://technet.microsoft.com/en-us/sysinternals/bb897443.aspx sdelete].
To do the same with a windows VM, you can use Microsoft's tool [http://technet.microsoft.com/en-us/sysinternals/bb897443.aspx sdelete].
Line 100: Line 100:
The trigger to zero space with 0x00 has changed to -z!
The trigger to zero space with 0x00 has changed to -z!


=== Shrink the disk ===
== Shrink the disk ==


Then power down the VM and open a terminal on the Linux host.
Then power down the VM and open a terminal on the Linux host.
Line 116: Line 116:
Note that vmware-vdiskmanager is probably not in your search path, so you might have to prepend the vmware-vdiskmanager command with the actual path with the command is located.
Note that vmware-vdiskmanager is probably not in your search path, so you might have to prepend the vmware-vdiskmanager command with the actual path with the command is located.


=== Shrink using vmware tools ===
== Shrink using vmware tools ==


Nowadays you can also shrink the guest by using the shrink feature as offered via vmware tools.
Nowadays you can also shrink the guest by using the shrink feature as offered via vmware tools.
1,274

edits