I am using Google Compute Engine VM for a web server. Is it possible to setup a RAID type of disk structure with the virtual machine? I basically would like ti have 2 disks on the machine where they are always mirrored and in case one disk fails the other automatically takes over with no data loss or down time. Thanks for your help.
-
Google's virtual storage is [already redundant](https://cloud.google.com/compute/docs/disks). What is the point of this? – Michael Hampton Mar 09 '21 at 21:56
-
Can you tell me in a regular situation with no persistent disk set up, what happens if the disk crashes? Does a new disk automatically take over with no data loss? Or do I personally need to create a new disk? – Armen Geo Mar 10 '21 at 18:19
-
You would never notice such an event; it is utterly transparent. It may have happened ten times already for each of your running VMs. Google handles it and you do not need to do anything. There is not even any way to find out if a disk failed; it is entirely automatic. – Michael Hampton Mar 10 '21 at 20:39
-
Thanks for your response. When you say it is utterly transparent do you mean with or without using persistent disk? – Armen Geo Mar 10 '21 at 21:21
-
What other disk would your VM be using? – Michael Hampton Mar 10 '21 at 21:30
1 Answers
For this scenario, I will recommend other options for having always availability on your web service, as the issue is often the instance itself and not the disk regarding GCE running websites possible issues.
First thing to have in mind is to have a robust system, since a lot of us never take this in mind when using GCP compute engine (specially for web servers) as certain events are unpredictable, and it is best to be prepared for these events (region out of resources, ongoing known issues, VM failure).
I can tell that creating a Managed Instance Group will work for you as it will keep your service up in case of failure, it let you operate apps on multiple identical VMs. You can make your workloads scalable and highly available by taking advantage of automated MIG services, including: autoscaling, autohealing, regional (multiple zone) deployment, and automatic updating.
You can use managed instance group (MIG) for scenarios like these:
-Stateless serving workloads, such as a website frontend.
-Stateless batch, high-performance, or high-throughput compute workloads, such as image processing from a queue.
-Stateful applications, such as databases, legacy applications, and long-running batch computations with checkpointing.
A managed instance group creates each of its managed instances based on the instance template and optional stateful configuration that you specify.
Since you are searching for high availability on your web server, Instance groups keeps VM instances running. If a VM in the group stops, crashes, or is deleted by an action other than an instance group management command (for example, an intentional scale in), the instance group automatically recreates that VM in accordance with the original instance's specification (same VM name, same template) so that the VM can resume its work.

- 11
- 1
-
Can you tell me in a regular situation with no persistent disk set up, what happens if the disk crashes? Does a new disk automatically take over with no data loss? Or do I personally need to create a new disk? – Armen Geo Mar 10 '21 at 18:19
-
You can use HDD as regional persistent disk. Regional persistent disks have storage qualities that are similar to zonal persistent disks. However, regional persistent disks provide durable storage and replication of data between two zones in the same region. In the event of a zonal outage, you can usually failover your workload running on regional persistent disks to another zone by using the --force-attach flag. This flag lets you attach the regional persistent disk to a standby VM instance even if the disk can't be detached from the original VM due to its unavailability. – Airus Mar 17 '21 at 17:20