Hello all,
I am testing VMware Workstation Player, and VMware Workstation Pro, current version 15.5.6.
I created a Windows 10 64-bit virtual machine, and two Linux virtual machines.
Linux fstrim, and Windows 10 retrim of free space, do not seem to work.
My question is, does trim work when deleting files in virtual machines, by informing the host SSD for the unallocated space?
Just for comparison, trim works in VirtualBox virtual machines, if you run once in Host OS, the command:
vboxmanage storageattach "virtual machine name" --storagectl "SATA" --port 0 --type hdd --medium "virtual hard disk name.vdi" --nonrotational on --discard on
When you run fstrim / retrim free space, or delete files, in the Guest OS, the virtual hard disk gets resized, and the Host SSD gets informed of the unallocated space.
Thank you a lot.
Hi,
You are basically describing the shrink feature.
With the VM shut down:
On a Windows host, with a Windows guest and VMware Workstation Professional you can use:
Right click -> Manage -> Clean up disk
On a Linux host and with Linux or Windows guests on Workstation Professional you can use the option "Compact Disk" which is found under "Edit configuration" select the hard disk and use the "Compact" button.
With the VM running you can use the vmware tools options in the guest.
For more info and options for VMware Player see also:
Shrink guest on hosted platform - VI-Toolkit
--
Wil
Hi,
You are basically describing the shrink feature.
With the VM shut down:
On a Windows host, with a Windows guest and VMware Workstation Professional you can use:
Right click -> Manage -> Clean up disk
On a Linux host and with Linux or Windows guests on Workstation Professional you can use the option "Compact Disk" which is found under "Edit configuration" select the hard disk and use the "Compact" button.
With the VM running you can use the vmware tools options in the guest.
For more info and options for VMware Player see also:
Shrink guest on hosted platform - VI-Toolkit
--
Wil
No, it is not a solution. The shrink feature can only reduce the zero-filled blocks, and the blocks of deleted files won't be zero-filled on the guest without the trim support.
If this feature is simply not implemented, then it would be much better to admit it.
Hi,
A few things...
1) I do not work for VMware, this is a community forum and answers are given by other users. As such I try to help and have "nothing to admit" as I cannot make statements for VMware.
2) Contrary to your report my answer is not a duplicate. To clarify, I'm a user admin and handle reports, so your report about my answer.. ended up on my plate ;)... But I think I understand why you reported my answer as a dupe. When a user considers an answer to be correct and marks it as correct, the answer will be copied - by the forum software - directly under the question.
This is confusing, more so in this case, and does indeed make it look like a duplicate.
I have made a note of this and will bring it up in the next moderator meeting, thanks for the report.
3) What you want is not implemented, sorry.
--
Wil
Ok, thanks.
Meanwhile, I found that a disk.scsiUnmapAllowed = "TRUE" in the .vmx descriptor of the VM might help. On VSAN it is a documented feature ( https://blogs.virtualmaestro.in/2018/12/25/what-is-trim-unmap-in-vsan-6-7/ ).
The vmware-vmx binary (this executes a VM) contains this string on a vmware workstation. I tried it, simply by adding this line to the .vmx, but it did not change anything. The guest still can not see a trimmable block device. I also tried to change the virtual disk to an NVME type (commonly used by trimmable disks today), also with no success.
Btw, trim support on the guest needs some manual writing of the VM xml config even in VirtualBox, but there it at least works.
Possibly some OS-specific guest addon could exist which zeroes out files on deletion. Using that, your answer would be close what we want to have. But the correct solution would be that the virtualization engine should report a trimmable block device to the guest OS.
