3

Is it possible to have a single btrfs mounted volume read-only mounted across multiple machines?

Can one of the hosts mount it read/write to provide updates to the others?

The reason I'm asking this is I'm wondering if it's sensible to mount /var/lib/docker to multiple CoreOS instances. What do people do in practice for private clouds? particularly netbooted instances.

Or should I create a unique block device mounted at /var/lib/docker for each physical host and link it to a private registry?

https://coreos.com/docs/cluster-management/setup/mounting-storage/

hookenz
  • 14,472
  • 23
  • 88
  • 143
  • 1
    Why not just mount a NFS? Or DRDB? – mailq Oct 08 '14 at 21:56
  • Because CoreOS requires btrfs for docker. Unless I can switch it to use aufs or the much slower vfs. – hookenz Oct 08 '14 at 22:01
  • Oh, so you are referring to the container storage and not the data volume storage. Latter one could be on any FS. – mailq Oct 08 '14 at 22:06
  • Correct. I'm really just getting my head around how docker works in practice and I guess wondering what people do for production. I haven't found a common answer to that. It seems that I may need each docker instance to have it's own storage anyway as they each may need to write. So shared storage is probably not sensible. I may just need a private registry and pull from their for each machine which will store a local copy to to either an internal drive or unique per node mounted drive. – hookenz Oct 08 '14 at 22:09
  • Absolutely! This is the way to go. Containers (better instances) are "stateless" and meant to run-stop-drop. – mailq Oct 08 '14 at 22:24
  • I'm trying to see how you would be stopped from making a "storage container" that acted as a shared filesystem for all of your other docker instances, and have all of the other docker instances point to it (NFS perhaps?). The other containers would continue to be "stateless" because the state would be on that one instance only. – Avery Payne Oct 08 '14 at 22:37

1 Answers1

3

I can't imagine this would end well. btrfs isn't a cluster filesystem and, even though you're talking about doing read-only mounts, filesystem metadata cached in memory by each node mounting the filesystem will be out of date when the filesystem is written to. Without a cache invalidation mechanism (which a real cluster filesystem would have) you're going to start seeing inconsistencies on the reading nodes.

Evan Anderson
  • 141,881
  • 20
  • 196
  • 331