Stay safe -- flush your Windows cache to disk with Sysinternals Sync

If you regularly use removable drives on PCs then you probably already know they should be ejected (right-click in Explorer, select Eject) before you unplug them. This is because Windows normally caches disk writes for performance reasons, temporarily saving them in RAM; unplug a drive before its cache is flushed and you’re going to lose data.

It's not only removable drives which are at risk, though – Windows caches writes to regular hard drives, too. This is only for a few seconds and so unlikely to cause problems, but again, if something drastic happens before the cache is written -- a blue-screen crash, a power outage -- then data will be lost.

If you're tired of manually ejecting USB keys, then, or would just like some protection for your other drives, then you might be interested in Sysinternals Sync. It's a tiny free tool which you can use to flush the cache for any or all of your drives, whenever you like.

Sync must be launched as an administrator, but that's its only real complication. Run the program without any parameters and it will flush any cached data for your fixed drives: easy.

Use  sync -r  and the program flushes data for fixed and removable drives.

Specify particular drives -- like  sync c e h  -- and the program will flush cached data for those drives only (quicker than flushing the entire system).

If you need to flush the cache for a removable drive and you're not sure what the drive letter will be, then you can just give the program several possibilities, like  sync h i j k  . The program will test them all, and it won't matter if some don't exist.

As a bonus, you can also have Sync programmatically eject whatever removable drives you specify by using the -e switch ( sync -e g ).

Sync isn't a perfect replacement for the manual Eject command. In particular, it tells you when Windows has started to flush its cache, but not when it's finished, so you won’t get a "ready to unplug" message. The program does allow you to initiate flushing when you think it's best, though -- from a shortcut, a script, whatever you like -- and that's more than enough to make it useful.

3 Responses to Stay safe -- flush your Windows cache to disk with Sysinternals Sync

© 1998-2024 BetaNews, Inc. All Rights Reserved. Privacy Policy - Cookie Policy.