Disaster Recovery Manual
GCP Cold DR Runbook with XReplicator
Full-width runbook for recovering Compute Engine workloads from XReplicator snapshots using boot-disk snapshot to image conversion, DR instance creation, and restored data-disk attachment.
Workflow
- Restore boot and data disks to a staging host with XReplicator disk restore.
- Create persistent disk snapshot from restored boot disk.
- Create image from that snapshot.
- Create DR VM from image.
- Attach restored data disks and validate application readiness.
Prerequisites
- Backup server reachable from DR VPC/project.
- Staging Compute Engine VM with XReplicator agent connected.
- Target Persistent Disks attached with same sizes as source disks.
- No pre-formatting required on restored target disks.
CLI Commands
Run after XReplicator has restored source disk content to staging-attached disks.
Set variables
# Required variables
export PROJECT_ID=my-dr-project
export ZONE=us-central1-a
export MACHINE_TYPE=n2-standard-4
export NETWORK=default
export SUBNET=default
export SERVICE_ACCOUNT=dr-vm@my-dr-project.iam.gserviceaccount.com
export DR_VM=dr-recovered-vm
# Restored disks from XReplicator on staging VM
export RESTORED_BOOT_DISK=restored-boot-disk
export RESTORED_DATA_DISK_1=restored-data-disk-1
export RESTORED_DATA_DISK_2=restored-data-disk-2
gcloud config set project "$PROJECT_ID"Create boot snapshot
# 1) Create snapshot from restored boot disk
BOOT_SNAP=dr-boot-snap-$(date +%Y%m%d%H%M%S)
gcloud compute disks snapshot "$RESTORED_BOOT_DISK" \
--zone "$ZONE" \
--snapshot-names "$BOOT_SNAP"
echo "Boot snapshot: $BOOT_SNAP"Snapshot to image conversion
# 2) Create image from snapshot
DR_IMAGE=dr-boot-image-$(date +%Y%m%d%H%M%S)
gcloud compute images create "$DR_IMAGE" \
--source-snapshot "$BOOT_SNAP" \
--family dr-recovery-family
echo "DR image: $DR_IMAGE"Bring up DR VM from image
# 3) Bring up DR VM from recovered image
gcloud compute instances create "$DR_VM" \
--zone "$ZONE" \
--machine-type "$MACHINE_TYPE" \
--subnet "$SUBNET" \
--image "$DR_IMAGE" \
--service-account "$SERVICE_ACCOUNT" \
--scopes https://www.googleapis.com/auth/cloud-platformAttach restored data disks
# 4) Detach restored data disks from staging VM (if still attached there)
# Replace STAGING_VM with your staging host name
gcloud compute instances detach-disk STAGING_VM \
--disk "$RESTORED_DATA_DISK_1" \
--zone "$ZONE"
gcloud compute instances detach-disk STAGING_VM \
--disk "$RESTORED_DATA_DISK_2" \
--zone "$ZONE"
# 5) Attach restored data disks to DR VM
gcloud compute instances attach-disk "$DR_VM" \
--disk "$RESTORED_DATA_DISK_1" \
--zone "$ZONE"
gcloud compute instances attach-disk "$DR_VM" \
--disk "$RESTORED_DATA_DISK_2" \
--zone "$ZONE"Validation Checklist
- Recovered VM boots from new image.
- All restored data disks are attached and mounted.
- Application and service checks pass.
- Traffic cutover and DNS updates are completed.