Share Persistent Disk between Multiple Instances



In this tutorial, we are going to see how to share a non-bootable persistent storage disk between two VM instances. Keep in mind that, the instance which is going to get accessed remains in read-only permission. 

Benefits of sharing disks 


  • Less storage consumption between multi-instance application
  • Save replication practice
  • Reduce the billing
  • Read operations can be distributed
  • Ease of access 


Steps to share the disk


In this example, let us consider that we have an instance called datacloudies-template-1 which holds two standard persistent disks.

datacloudies persistent disk

Disk-1 is the non-bootable instance that is going to be shared with another instance called datacloudies-2.

datacloudies persistent disk

Let us connect to the gcloud and attach the disk-1 to datacloudies-2 instance.

gcloud compute instances attach-disk datacloudies-2 --zone us-central1-a --disk disk-1 --mode ro

datacloudies persistent disk

Make sure to provide the mode as read-only. Otherwise this will not allow you to attach as RW.

datacloudies persistent disk

Verify the disk-1 attached to both the instances,

Go to disk and check the status,

datacloudies persistent disk

Now, disk-1 is attached to both datacloudies-2 and datacloudies-template-1 instances. If you want to format and mount the filesystem, then follow this tutorial


Recent Posts

  • Cloud SQL
    What is Cloud SQL  It is a fully managed relational database service for PostgreSQL and MySQL database in the GCP. MySQL instance can be...
    May 17 2020 | Read more
  • Deploy an application to Google Kubernetes Engine
    Welcome back, this is the continuation post of the previous article, where we have discussed the Kubernetes and its concepts in detail. In this...
    May 13 2020 | Read more
  • Google Kubernetes Engine
    What is GKE? GKE is a managed, production-ready environment for deploying containerized applications. It is like a managed cargo container in...
    May 13 2020 | Read more
  • Google App Engine – Flexible
    In the previous article, we have discussed what is google app engine and how to deploy the application in the Google app engine – Standard. In...
    May 10 2020 | Read more