Writes go to the page cache first and reach disk later (see the flush thread). sync forces all pending writes to disk.
sync # flush everything
sync /path/to/file # flush one file (coreutils 8.24+)
sync -f /mnt/usb # flush the filesystem containing this path
Run sync before pulling a USB drive, taking a snapshot, or rebooting by force. umount and eject sync as part of their work, so prefer them. Reference: Sync (Unix).
sync is not the same as dropping caches (echo 3 > /proc/sys/vm/drop_caches throws away clean cached data for testing and does nothing to protect dirty data).