Search code examples
google-compute-engine

Attaching a disk to multiple GCE instances with one write access


I'm thinking about upgrading my company's integration server with a the repos on a separate disk that would be shared with a backup server. Like so:

[Main Integration Server] ---R/W--- [Repo Vdisk] ---R/O--- [Backup Integration Server]

My problem is that according to the GCE docs, if I attach the same Vdisk to more than one instance, all instances must only access the disk in read-only mode. What I'm looking to do would be to have one instance access it in read-write, and one in read-only mode.

Is this at all possible without powering up a third instance to act as a sort of "storage server"?


Solution

  • As you quoted from the docs and as mentioned in my earlier answer, if you attach a single persistent disk to multiple instances, they must all mount it in read-only mode.

    Since you're looking for a fully-managed storage alternative so you don't have to run and manage another VM yourself, consider using Google Cloud Storage and mount your bucket with gcsfuse which will make it look like a regular mounted filesystem.