How to Restore deleted VM instances from Google cloud without snapshots

15,066 views
Skip to first unread message

Raj kumar

unread,
Jul 16, 2018, 9:05:19 AM7/16/18
to gce-discussion
Hey,favorite

I accidentally deleted the VM instances and data from Google cloud, right now i do not have the snapshots of that vm Instance, can you please help me how to restore that VM Instance and data from google Cloud. When i am trying to contact with support team they ask support package $150, please help me..

Shaiq Muhammad (Google Cloud Support)

unread,
Jul 16, 2018, 1:38:15 PM7/16/18
to gce-discussion

Hello Raj


Thank you for your post.


As described in this article, you can use GCE snapshots to create diff-based backups of persistent disks attached to the instance, including boot volumes. This is useful for backing up your data, recreating a disk that might have been lost, or copying a persistent disk. That being said, currently this is the method you can recover deleted instances. Generally, snapshots are used to backup data from your persistent disks and you can create an instance from your snapshot by following the instructions on this article.  


Therefore, unfortunately if there are no snapshots taken already from the VM’s disk(s), the deleted VM instance cannot be recovered. Even if you had a support package we would not be able to help you on this issue.  We provide support over the platform behaviour but the backup policy lies on the customer side.


At this point, if you wish a recovery option to get implemented in the future, please don’t hesitate to vote up the feature request posted on this thread.


Justin Reiners

unread,
Jul 16, 2018, 3:33:24 PM7/16/18
to gce-discussion
Sorry to see you were having issues with snapshots. I use a script similar to below to make daily snapshots

#!/bin/bash

dt=`date +%Y-%m-%d`
echo $dt
#exclude_list="NAME"
all_disks=`gcloud compute disks list |awk '{print $1"="$2}'|grep -v $exclude_list`
for line in `echo -e $all_disks` ;do
  zone=`echo $line |awk -F"=" '{print $2}'`
  disks=`echo $line |awk  -F"=" '{print $1}'`
  gcloud compute disks snapshot $disks --zone $zone --snapshot-name "internal-daily-$disks-$dt"
done

echo -n "{ \"to\": \"15559909929\", \"from\": \"$myphone\", \"msg\": \"Daily snapshots are complete, what what...\" }" >/dev/tcp/sms123.cloud.notlinesinc.com/2000

I run this script 3 times, once for daily, once for weekly, once for monthly snapshots.

I have another script I use to delete the snapshots older than x days for dailies I'd share if interested. To use this script, just install gcloud.

Sidharth Mohan

unread,
Aug 11, 2020, 1:56:23 PM8/11/20
to gce-discussion
Hi Justin Reiners,

Can you please provide below script for gcp.

"I have another script I use to delete the snapshots older than x days for dailies I'd share if interested. To use this script, just install gcloud."

Thanks
Sid


Carlos (Cloud Platform Support)

unread,
Aug 20, 2020, 4:08:15 PM8/20/20
to gce-discussion

In the old days scheduling snapshots had to be done by building scripts.  Nowadays, this is not required as GCP has a feature that can manage the scheduling and retention policy. 

Justin Reiners

unread,
Aug 20, 2020, 4:56:41 PM8/20/20
to Carlos (Cloud Platform Support), gce-discussion
I agree with Carlos, the old way of snapshotting was a pain, the new way is better.
 

Justin Reiners

unread,
Aug 20, 2020, 4:57:52 PM8/20/20
to Carlos (Cloud Platform Support), gce-discussion
We've got about 200 machines I used to manage with scripting, it was bullet proof, but deletes would sometimes fail and I'd have to run the script a couple times to clean up the failures
Reply all
Reply to author
Forward
0 new messages