I am running a windows 7 vm on esxi connected to x25-M G2 via iscsi, which is running starwind iscsi on server 2008. Is trim a function of the vm OS or the iscsi server OS or not applicable with ISCSI?
Since TRIM seems to be a "Hardware Command" the SSD must be connected directly on the physical host which is your iSCSI host if I get your right. So this means that this host must support trim. Windows 2008 R2 supports this feature so if you running the R2 version I think you will enjoy the benefits of TRIM. The virtual machine gets a virtual hard drive via iSCSI and doesn't care about the backend.
In order for TRIM to be effective, the SSD driver on the host would need to know when files are deleted on the SSD. Since the host is just presenting the disk by iSCSI, I don't think it would know when the guest is deleting files (that's a filesystem-level operation, and iSCSI works at a lower level). Jul 15, 2010 at 15:13
TRIM must be implemented by every single layer of the stack to be useful. If you used a physical raw device mapping instead of VMFS to provision your Windows 7 guest, and Starwind supports TRIM (which I don't know about) then you might be in with a chance.
Otherwise, since ESXi doesn't support TRIM, every time you delete a file in your virtual machine, it just updates a few blocks in the vmdk, which are passed through as a few iSCSI writes, which Starwind+2008R2 pass though as a few writes to the x25, and 2008R2 never learns that there are now free blocks that it could TRIM. In other words, even though 2008R2 would send TRIM down to the X25 if Starwind ever deleted some blocks, it never will because ESXi will never send an iSCSI TRIM to Starwind.
See http://www.t10.org/ftp/t10/document.08/08-347r1.pdf for some good reasons why Starwind probably doesn't implement TRIM either.