I could not find much reference on this. Maybe someone can shed more light on this, as I have not grokked the source, but it seems as though a sync
writes to disk.
One point is the questions trim-with-lvm-and-dm-crypt where a sync
changes the disk content reliably, yet the cached content is only updated after a echo 1 > /proc/sys/vm/drop_caches
.
Another is the issue that sync
hangs on a suspended device, which indicates that the sync goes directly to the device.
A third is this Gentoo discussion where luksClose
is possible reliably after a sync
.
A fourth is this UL answer, which says
the rest of the stuff [dm-crypt] is in kernel and pretty heavily used, so it's
probably fine
It may still be that all these are wrong, and it can happen that sync
does not write directly to the encrypted disk, but it seems unlikely.