Google Cloud: Snapshots — Working with backups of Persistent Disk of VM

Share At:

What is a Persistent Disk?

Compute Engine provides several different types of storage options that you can choose while creating an Instance.

Persistent disks are durable network storage devices available for your instances, and You can access it like a physical disk on a desktop.

Persistent disks can be created independently from your Compute Engine (VM) instances so that you can detach the disks to keep your data after deletion of instances or attach to different VMs. The performance of these disks scales automatically with size, and you can resize your existing disks or add more persistent disks to your instance to improve your performance or storage needs.

There are multiple Disk options available while creating a Disk:

First, you have to choose a Zonal or Regional disk type. As the name specifies Zonal persistent disks have disks available in a single Zone. Still, regional disks offer durable storage and redundancy of data between two zones in the same region.

  • Standard persistent disks are just like using standard hard disk drives (HDD).
  • Balanced persistent disks are just like using solid-state drives (SSD) but with balanced performance and cost.
  • SSD persistent disks are just like using solid-state drives (SSD).

Now about the backup solution:

Let’s try to understand with the help of an example, If you have ever used a portable HDD or SSD, you might have heard of accidentally dropped the disk, or suddenly the disk stopped working if something goes wrong for any reason. To avoid such cases, we should always have a backup ready.

In Google Cloud, there are two ways that one can use to keep data safe and enable point in time recovery.

One common way to create a Google Cloud backup is to create a Snapshot manually, but that is not sufficient to protect the data, we cannot ensure if all the data is protected, let’s say manual snapshot is too old. Here we can create the snapshots automatically at a given schedule with the frequency you choose depending on the updates you make on data.

You can also choose time to retain the snapshot using the snapshot retention policy. They allow you to create a point-in-time backup of a persistent disk and save it to Google Cloud Storage.

A snapshot is an incremental copy of your data — the first snapshot contains all the data after that snapshots only save data blocks that changed after the last snapshot. You can refer to the below diagram. It is quite clear from the diagram.

You can choose between given location options when saving a snapshot:

  • Multi-regional location — Saving a snapshot in a multi-regional location means the snapshot will be replicated across multiple regions.
  • Regional location — Saving a snapshot to a regional location means the snapshot will be stored in one region only and allows you to choose the specific region it will be stored in.

Lab Details:

  1. This lab walks you through GCP Storage Disk, Snapshot for backup and snapshot schedule.
  2. In this lab, we will create a Storage Disk.
  3. You will create a snapshot manually and a snapshot schedule.

Lab Tasks:

  1. Login into GCP Console.
  2. Creating a Compute Engine Disk
  3. Creating a Snapshot manually.
  4. Creating a Snapshot schedule.

Creating a Compute Engine Disk:

  1. Click on the hamburger icon on the top left corner
  2. Click on Compute Engine.

3. Click on Disks in the left Sidebar.

4. Click on Create Disk to begin creating the disk.

5. Enter the name as storage-disk.

6. Choose the type as Standard persistent disk, the region as us-central1 and zone as us-central1-a and choose no schedule in snapshot schedule, we will create a schedule later on.

7. Choose the source type as Blank Disk and enter the size as 50 GB.

8. Choose the encryption as the default Google-managed key.

9. Click on create to finally create your disk.

Creating a Snapshot manually:

  1. Click on Snapshots in the left sidebar.
  2. Click on Create Snapshot.

3. Enter the name as disk-snapshot.

4. Choose the source disk as storage-disk which you just created.

5. Choose the location type as multi-regional and location US.

6. Click on Create.

Creating a Snapshot schedule:

  1. Click on Create Snapshot Schedule from the top bar as shown.

2. Enter the name as snapshot-schedule. Do not enter any other name, it is required to validate the lab.

3. Choose the region as us-central1.

4. Choose the snapshot location as US and the location type as Multi-regional.

5. Choose the schedule frequency as weekly.

6. Choose the Day of the week as Sunday andStart timeas 4:00 AM — 5:00 AM, as in most cases, we always prefer to take backups in the night time when the traffic is minimal.

7. Enter the autodelete snapshots after 30 Days.

8. Choose Keep snapshots even if you delete the disk.

9. Click on Create.

Completion and Conclusion:

  1. In this lab, you have created a Compute Engine Disk.
  2. You have created a Snapshot manually.
  3. You have created a Snapshot schedule to create a snapshot automatically at a given point in time.

Happy Learning !!!

Share At:
0 0 votes
Article Rating
Notify of
Oldest Most Voted
Inline Feedbacks
View all comments
hitbtc vs binance
1 month ago

Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?

gate io
2 months ago

I have read your article carefully and I agree with you very much. So, do you allow me to do this? I want to share your article link to my website: gate io

Back To Top

Contact Us