I'm looking for a way to flush all pending writes to disk in Windows, then buffer all future writes until a command gives the go-ahead.
I'd like to flush SQL Server writes and Windows system writes, then buffer both.
To be clear about what I'm doing:
I use Windows 2008 R2 and SQL Server 2008 R2 on EC2. I run an hourly snapshot on the drive these reside on. When nothing critical is changing, these snapshots come out just fine - but every now and again I get a bad snapshot. Worst-case scenario, in the event of drive failure (EBS failure technically), if I have 3 bad hourly snapshots I've lost 4 hours of data.
The snapshots already solve the fast, differential backup, and fast, easy restore - so all I'm looking for is a way to flush everything so it's in a consistent state on disk, then suspend all writes until the snapshot is complete. I'm happy to write some code for a service I call into to make this happen, but I need to know what APIs/commands I need to write against in order to get the task done.
I'm aware that I could create a separate volume which I continually run Windows Backup to and then snapshot that, but that significantly lengthens the backup process and feels like a hack. I know Windows and SQL Server are both very good at buffering writes, so this seems like something I should be able to accomplish in-place.