rancher / convoy

A Docker volume plugin, managing persistent container volumes.
Apache License 2.0
1.31k stars 135 forks source link

sync() and fsfreeze() when creating a snapshot #195

Open peebles opened 7 years ago

peebles commented 7 years ago

Inspired by the ec2-consistent-snapshot project, I wonder if, when creating snapshots, it'd be nice to run sync() and fsfreeze() before creating the snapshot, and then unfreezing. I am tempted to create a pull request for this, if anyone thinks this is useful or even necessary in the context of docker volume plugins. Please advise.

yasker commented 7 years ago

It's really interesting. I think it's useful. It makes EBS snapshots to be application consistency instead of crash consistency. A PR will definitely be welcome!

peebles commented 7 years ago

I have something working ... I'll generate a PR request momentarily.

yasker commented 7 years ago

thanks! @peebles

peebles commented 7 years ago

By the way ... sync() and fsfreeze() for for EBS driver. For VFS, fsfreeze() does not work... I guess that isn't supposed to work with NFS mounted file systems. I haven't found any alternatives. So for VFS I'll just sync(). For device mapper it seems neither sync() or fsfreeze() are appropriate as device mapper natively supports snapshots with suspends.

So I think I'll hard code the sync() into VFS and EBS, and I'll make fsfreeze() a driver option for EBS, false by default. What do you think?

yasker commented 7 years ago

That's very reasonable. I thought it was only for EBS, but it's nice to have sync() for VFS as well.