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)