this works great but in my experience sometimes you should add
&& sync
not sure why it's necessary only sometimes! && sync
not sure why it's necessary only sometimes!If you want to be more targeted:
blockdev --flushbufs /dev/sda