Welcome to the Community - The fsync command will be handled by the guest OS - the ESXi server virtualize the resources used by the VM including disk so when the VM issues a write the ESXi takes that write and performs it within the VMDK or RDM - the guest insures the wirte is done the same way it is done in the pphysical world -
Hi, thanks for your reply. Does that mean that ESX just does its own write caching/syncing to the vmdk file irrespective of the guest syncing requests and that there is no way to control this from the guest?
More details about my question:
We have a mail server running on a VM (linux ext2 partition, backed by a local vmdk image) which returns "OK" to the client only after having called fsync() on the received email file to make sure that the message is physically written to disk before sending a confirmation to the client. So if the client gets an "OK", it knows that the file has definitely been received. In case of a crash between fsync() and the "OK" response, the client might re-send the message but that's an acceptable scenario.
What we have observed is that if we send a lot of emails to the server and "pull the plug" on the ESX host, we actually lose some messages that were confirmed as "OK" by the server. This means that fsync() didn't actually sync the files to the physical disk.
We did the same test with the smtp server running on physical tin and we saw the normal behaviour (number of messages saved = number of "OK" sent to client)
So how can we ensure that ESX actually syncs the data to disk?