add fsync to write snapshot()