34

On *nix systems, a user can use the sync command to force any pending writes in the kernel's disk cache to be flushed to disk. Does Windows have a similar command?

2
  • In addition to the great answers below, if the drive is external, you can go into the device settings and disable the write cache completely. In theory, you can then pull the drive whenever you want, but I personally would still do a proper unmount. – RockPaperLz- Mask it or Casket Oct 30 '14 at 2:54
  • 1
    @RockPaperLizard: That's the default setting for external drives anyway, precisely because everyone just unplugs them without unmouting. – Joey Oct 30 '14 at 10:22
30

Yes - it's also called Sync, it's part of the SysInternals Suite:

Use it whenever you want to know that modified file data is safely stored on your hard drives. Unfortunately, Sync requires administrative privileges to run. This version also lets you flush removable drives such as ZIP drives.

4
  • Sorry, I didn't see your answer until I had submitted mine. – AFH Oct 30 '14 at 0:38
  • It says it was last updated in 2006. Has anyone tried this on a modern operating system like Windows 7 SP1 or Windows 8.1? – Jason Oct 30 '14 at 15:39
  • Folks are saying it works in Win8 here: forum.sysinternals.com/syncexe-how-to-use_topic25219.html. They say it's not working in Win8.1, but it seems the problem is they don't know that it's a command line tool. I don't have a Win8.1 machine to test on. Seems fine on Win7. – Jon G - Megaphone Tech Oct 30 '14 at 15:47
  • 1
    Any ideas how is it implemented? I'd like to include this feature in a Python program. – Aivar Feb 19 '18 at 8:36
12

Yes. Looking for sync.exe I found that there is a SysInternals program to do just that. I have not used it, but I have never found a SysInternals utility which did not work extremely well.

It can be down-loaded separately, or as part of the Suite.

5

Windows Powershell has the "Write-VolumeCache" command, and it does not require administrator privileges.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.