I\'m writing a backup script which
Does sync
suffice?
Edit: regarding your edit - you are trying to avoid sync because some guy on the internet put a CYA disclaimer on his post? Maybe there is something wrong with sync of which I am unaware but that might be worth a 2nd post in itself.
Still, from the linux info pages:
sync writes any data buffered in memory out to disk. This can include (but is not limited to) modified superblocks, modified inodes, and delayed reads and writes. This must be implemented by the kernel; The sync program does nothing but exercise the 'sync' system call.
You want fsync (man section 2) function call, but if you're doing this in a script, you'll probably want to use the sync command (man section 8), which just calls sync().