Snapshots and Images in Google cloud Platform

Diana Moraa
5 min readMar 22, 2022
  1. SNAPSHOTS

A snapshot is an exact copy of a disk as it exists at a specific point in time and it can even be taken while reads and writes are happening to the disk being snapshotted.

Because snapshots are so easy to use, they’re an appealing backup solution for VM instances. By scheduling snapshots regularly, you can ensure you never have to deal with lost data.

When working with snapshots, it’s important to note that they are incremental and they are automatically compressed. What this means is that the first successful snapshot of a persistent disk is, in fact, a full snapshot. It contains all the data that resides on the persistent disk being snapshotted. However, the second snapshot only contains new data that’s been written to the disk since the first snapshot. The second snapshot will also contain existing data that’s been modified since the first snapshot. Although the second snapshot doesn’t contain any data from the first, the second snapshot does contain pointer references to the first snapshot for any unchanged data that’s contained in the first snapshot.

If you take a third snapshot, that third snapshot will contain any new or changed data since the second snapshot. Instead of including unchanged data from the first two snapshots, the third one will contain pointer references to blocks in the first two snapshots for any unchanged data. This process repeats itself for any subsequent snapshots that you take.

You can create a snapshot manually or through a snapshot schedule

a)CREATING A SNAPSHOT MANUALLY

b) CREATING A SNAPSHOT THROUGH A SNAPSHOT SCHEDULE AND ATTACHING DISK

Before creating a snapshot schedule, choose a start time and a snapshot frequency. The start time is when you want the snapshot schedule to begin. The frequency is defined as hourly, daily, or weekly.

A snapshot schedule begins within the hour of the specified start time. For example, if the scheduled start time is at 1:00am, snapshotting starts anytime between 1:00am and 2:00am.

Snapshot schedule: the best and recommended. You can set up the schedule and do your frequency and attach disks to the schedule and forget about it.

2. IMAGES IN GCP

You can use images to archive application versions for disaster recovery, and even to roll back an instance. After registering an image, the image can be used to create one or more exact replicas of the original disk.

You can use operating system images to create boot disks for Compute instances.

There are two types of images available. They include public images and custom images.

Public images are provided and maintained by Google, open-source communities, and even some other third-party vendors. All GCP projects have access to public images so they can be used to create instances. There are many pre-configured public images available in Compute Engine that have compatible Linux operating systems and Windows operating systems. These systems images can be used to create and start instances.

Custom images are available only to your project. Custom images can be created from boot disks and even from other images. After creating a custom image, you can use it to create an instance. You can use a custom image to import a boot disk image from an on-prem machine into Compute Engine. You can also use custom images to import virtual disks from existing virtual machines that are running in your environment. A custom image that’s imported into Compute Engine will not add any additional cost to your instances. However, it will incur an image storage charge, as long as you keep the custom image in your project.

a)CREATING IMAGES

When creating images, we need to shut down the Virtual machine to stop writing into it.

I will stop my test-Linux-instance so that I can stop writing into it.

Specify the Name of your image then Specify the Source from which you want to create an image. This can be a persistent disk, a snapshot, another image, or a disk. Raw file in Cloud Storage. In this case I specified the disk

In the Based on source disk location (default) drop-down list, specify the location to store the image.

For example, specify us to store the image in the us multi-region, or us-central1 to store it in the us-central1 region. If you don't make a selection, Compute Engine stores the image in the multi-region closest to your image's source location.

Optional: specify the properties for your image.

  • Family: the image family this new image belongs to.
  • Description: a description for your custom image.
  • Label: a label to group together resources.

Specify the encryption key. You can choose between a Google-managed key, a Cloud Key Management Service (Cloud KMS) key or a customer- supplied encryption (CSEK) key. If no encryption key is specified, images are encrypted using a Google-managed key.

CONCLUSION

WHAT IS THE DIFFERENCE BETWEEN A SNAPSHOT AND AN IMAGE

A snapshot reflects the contents of a persistent disk in a concrete instant in time. An image is the same thing, but includes an operating system and boot loader and can be used to boot an instance. Images and snapshots can be public or private.

--

--

Diana Moraa

Passionate and motivated about Cloud Computing technology because it continues to allow us to modernize, consolidate IT infrastructure and automate workloads.