3

This should be easy but ...

I have been working on a Google Compute Engine persistent disk image that I'm calling utilserver, and basically now need to build it again from scratch, but I might need the original one to try a few things in case problems come up. So I'd like to rename utilserver to utilserver-backup and then create a new utilserver that will hopefully end up being more correct. However, under the web console for my project there's only a "Delete" button, no "Rename" button. Neither does gcutil seem to have a rename command. Ok, I tried creating a snapshot of utilserver and then from that a new persistent disk called utilserver-backup, but when I did that the new disk looked like a completely new image--none of my prior installation work was on there. Any ideas here?

Purplejacket
  • 1,808
  • 2
  • 25
  • 43

2 Answers2

6

You can create a snapshot of your disk and then can create multiple disk from that snapshot. By creating the snapshot you will have the backup of your original disk. You can then delete the original disk and create a new one with the same name. You can refer to the following link for more details about snapshot: https://cloud.google.com/compute/docs/disks/create-snapshots

I personally have tried creating a new disk from snapshot using the following command and it created a new disk with all my data

gcutil adddisk <disk-name> --project=<project-id> --source_snapshot=<snapshot-name>
orad
  • 15,272
  • 23
  • 77
  • 113
Faizan
  • 1,937
  • 13
  • 18
1

gcutil has been deprecated in favor of gcloud compute.

gcloud compute disks create <new-disk-name> --source-snapshot <snapshot-name> --zone=<zone-name>

Example:
gcloud compute disks create production --source-snapshot production-backup-2023-01-23 --zone=asia-southeast1-b

iBoon
  • 13
  • 4