How to flush cache of hard-disk and flash-disk (or filesystem) from command line?

前端 未结 2 980
一生所求
一生所求 2021-01-03 22:41

I\'m writing a backup script which

  1. Copies the data to backup disk.
  2. Flushes the backup disk.
  3. Performs a hash integrity check.

2条回答
  •  借酒劲吻你
    2021-01-03 22:50

    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().

提交回复
热议问题