DEV Community

Cover image for Part-31: πŸ’Ύ Google Cloud Platform – Working with VM Disk Snapshots (GCP)
Latchu@DevOps
Latchu@DevOps

Posted on

Part-31: πŸ’Ύ Google Cloud Platform – Working with VM Disk Snapshots (GCP)

Snapshots are a powerful way to protect and restore data in Google Cloud Compute Engine. A snapshot is essentially a backup of a persistent disk that you can later use to:

  • Recover data if the disk is corrupted
  • Create new disks or VM instances quickly
  • Set up backup schedules for compliance and availability

In this tutorial, we’ll go step by step to:

  1. Create a snapshot from an existing VM disk
  2. Review snapshot properties
  3. Create a new VM or disk from a snapshot
  4. Set up snapshot schedules

πŸ”Ή Step 1: Start the VM

For this demo, we’ll use an existing VM (demo8-vm1).

πŸ‘‰ Console:

Go to Compute Engine β†’ VM Instances β†’ demo8-vm1 β†’ Actions β†’ Start

s1


πŸ”Ή Step 2: Create a Snapshot

You can create a snapshot directly from a VM’s disk.

Option 1 (from Disk):

πŸ‘‰ Compute Engine β†’ Storage β†’ Disks β†’ demo8-vm1 β†’ Actions β†’ Create Snapshot

Option 2 (from Snapshots page):

πŸ‘‰ Compute Engine β†’ Storage β†’ Snapshots β†’ Create Snapshot

Fill details:

  • Name: demo8-vm1-snapshot-1
  • Description: demo8-vm1-snapshot-1
  • Source disk: demo8-vm1
  • Location: Multi-regional β†’ us
  • Encryption: Use same encryption as disk
  • Application consistency: unchecked
  • Click Create βœ…

s2

s3

CLI Equivalent:

# Create Snapshot
gcloud compute snapshots create demo8-vm1-snapshot \
    --project=gcpdemos \
    --description=demo8-vm1-snapshot \
    --source-disk=demo8-vm1 \
    --source-disk-zone=us-central1-a \
    --storage-location=us
Enter fullscreen mode Exit fullscreen mode

πŸ”Ή Step 3: Review Snapshot Properties

πŸ‘‰ Go to Compute Engine β†’ Storage β†’ Snapshots β†’ demo8-vm1-snapshot

Here you can review:

  • Size
  • Storage location
  • Source disk
  • Creation timestamp

Snapshots are incremental in GCP β†’ only changes since the last snapshot are stored, saving cost and time.

s4


πŸ”Ή Step 4: Create VM or Disk using Snapshot

Snapshots aren’t just backupsβ€”you can also use them to spin up new resources.

πŸ‘‰ From Snapshots β†’ demo8-vm1-snapshot β†’ Actions:

  • Create Instance β†’ Launch a new VM from snapshot
  • Create Disk β†’ Provision a new persistent disk from snapshot

This makes snapshots super useful for cloning environments (like dev/test copies of production).

s5

s6

VM instance is created from the snapshot

s7

If you access the server through browser

s8


πŸ”Ή Step 5: Snapshot Schedules

Manually creating snapshots is fine, but production systems need automated protection.

Snapshot schedules let you define policies like:

Frequency: Hourly, Daily, Weekly

Auto-deletion: e.g., keep snapshots only for 14 days

Deletion Rule:

  • Keep snapshots indefinitely
  • Delete older snapshots automatically

s9

s10

πŸ‘‰ Example:

  • Take a daily snapshot
  • Retain only last 14 days
  • Auto-delete older ones

This ensures you always have recent backups without excessive cost.


βœ… Final Thoughts

  • Snapshots in GCP are lightweight, incremental, and multi-regional, making them ideal for backups.
  • You can restore, clone, or create new VMs/disks from them.
  • Schedules help automate backups and manage retention.

πŸ’‘ Pro Tip: Always store snapshots in multi-regional locations for disaster recovery.


πŸ‘‰ That’s it! You now know how to create, manage, and use snapshots in Google Cloud Compute Engine πŸš€

Top comments (0)