In the series of deploying and moving physical architecture to Cloud, let me share the steps for creating a VM in Google Cloud.

This blog post will cover how to attach a SSD based storage to a running linux (in our case CentOS 6) Virtual Machine instance, and recovery of your storage in case of your running VM creating issues, by attaching the same SSD disk to another recently created snapshot vm of the original CentOS 6 VM.

Protect Your Data with BDRSuite

Cost-Effective Backup Solution for VMs, Servers, Endpoints, Cloud VMs & SaaS applications. Supports On-Premise, Remote, Hybrid and Cloud Backup, including Disaster Recovery, Ransomware Defense & more!

Since Google cloud offers instances with 10Gb size, we completely rely on additional storage, and  you can attach maximum up to 10Tb of disk either a Standard persistent disk or SSD persistent disk.

Prerequisites

A Valid Google Cloud account, here is your starting point for signup

https://cloud.google.com/appengine/docs/adminconsole/

Download Banner
  • Working knowledge on Linux, installing applications, partitioning, mounting a disk etc.

Steps to create Google Cloud VMs:

  • Creating a VM, installing applications.
  • Creating a persistent disk, attaching that disk to the running VM.
  • Creating snapshot of the running VM.
  • Creating a new VM from the snapshot.
  • Detaching the disk from the running VM.
  • Attaching the disk to the new VM created by snapshot.

Walkthrough on Google Cloud:

  • Login to Google cloud Admin console using your credential.
  • Create new project → Select new project and you can see all the required actions in the left side as in the below slides.
  • Created a CentOS VM with static IP which is a 10 GB Standard persistent boot disk.
  • Install all your applications and services, in my case installed apache web server. Here you can see the VM details and note that no disk is attached.
  • Our next step is creating and attaching a 1 TB SSD disk with ext4 filesystem.
Google Cloud Platform that lets you build and host applications and websites, store data, and also to analyze data on Google & scalable infrastructure.

Google cloud

  • Creating and attaching a 1 TB SSD disk to the CentOS 6 instance.
  • Under the selected project, click Compute → Compute Engine → Disks .
  • Select create a new disk and fill up the details as given. Keeping both the instance and disk are in same region, select SSD disk for better performance. Click Create

2

  • Below screenshot shows Disk1 is created and is not attached to any VMs. Next step is attaching newly created disk to CentOS 6 VM.

3

  • Now go to Compute Engine → VM instances → select CentOS 6 VM. Under CentOS 6 VM properties you can see attach column and select 1TB disk. Then you need to select the mode, give read/write and click Attach disk.

4

  • You can verify the attached disk.

5

  • Next step is connecting the VM through SSH → Create partition → format the disk→ mount to particular directory.

6

7

8

Disaster recovery:

Assume that we are taking snapshot of CentOS 6 VM regularly and we are creating a new VM using latest snapshot. Below screenshot shows how take a snapshot of a VM manually. Google provides API also to take snapshot.

9

Creating a new VM using the snapshot:

  • Select VM Instances → Create new instance. On details:
  • Select Boot source → New disk from snapshot.
  • Select snapshot → latest snapshot name.

10

The new VM which is created from snapshot, does have Google assigned static IP. If you require to have same IP, Google cloud allow you to assign the IP to new VM once problematic VM is turned off. Else you can retain the static IP assigned while creation.

  •  Next step is detaching 1TB disk from problematic VM and attaching it to the new snapshot VM.

11

  • Click detach under Disks→ disk-1, the wizard will confirm you to detach. Click detach in the confirmation screen.
  • Select newly created VM by VM Instances→ Disks→ Click attach.
  • Select Disk1 and confirm the dialog box to attach.

Below screen shot shows the confirmation:

12

and verify through SSH.

13

Note:

It is a best practice to take snapshot of boot disk and attached disk at the same time and using it for recovery, in case of OS disk failure and/or data disk failure.

Rate this post